Tk Source Code

View Ticket
Login
2026-10-11
13:58 • Closed ticket [5b97764f]: Revised text: tag raise/lower does not update the elide state plus 6 other changes artifact: 7f6ad12b user: nab
13:58
Merge nab-tag-priority-elide: fix [5b97764fc6], tag raise/lower update the elide state (tests textTag-20.2 to 20.4). check-in: 31036584 user: nab tags: revised_text, tip-466
13:58
Fix [5b97764fc6]: tag raise/lower did not update the elide state. When the priority of an elide tag changes, the elided ranges from its first to its last range, extended to the enclosing elided ranges, are recomputed from the tag information. Tests textTag-20.2 to 20.4. closed check-in: a3f0ef6d user: nab tags: nab-tag-priority-elide
12:42 • Ticket [05411ee5] Revised text: inserting text with an -elide 0 tag into an elided range fails an assertion status still Open with 3 other changes artifact: b1fe54b2 user: nab
12:42 • New ticket [5b97764f] Revised text: tag raise/lower does not update the elide state. artifact: f4543c1a user: nab

Ticket UUID: 5b97764fc685d50bed6b668137441e456f9bb59c
Title: Revised [text]: tag raise/lower does not update the elide state
Type: Bug Version: revised_text
Submitter: nab Created on: 2026-10-11 12:42:12
Subsystem: 18. [text] Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2026-10-11 13:58:46
Resolution: Fixed Closed By: nab
    Closed on: 2026-10-11 13:58:46
Description:

Changing the priority of an elide tag does not change what is elided. The legacy widget gives cd and then an empty string; revised_text gives cd twice:

text .t
.t insert end abcdef
.t tag configure B -elide 1
.t tag configure A -elide 0
.t tag add B 1.0 1.6
.t tag add A 1.2 1.4
.t get -displaychars 1.0 end-1c
.t tag lower A
.t get -displaychars 1.0 end-1c

ChangeTagPriority only renumbers the priorities; the branches and links of the elided ranges are not updated. The update code (UpdateElideInfo with ELISION_HAS_BEEN_CHANGED) computes the previous state by toggling the elide value of the changed tag between 0 and 1, so it cannot express a change of priority. It cannot express a change from or to an unset -elide either, which may be why tag configure X -elide {} fails an assertion (see the comment in 05411ee533); I have not checked this. I do not propose a fix.

User Comments: nab added on 2026-10-11 13:58:46:

Fixed in [a3f0ef6d3c|a3f0ef6d3c], merged into revised_text with [31036584a3|31036584a3]. ChangeTagPriority now recomputes the elided ranges where the tag is set, from its first to its last range extended to the enclosing elided ranges, from the tag information (as the undo code does); undo and redo of a priority change go through the same path. Tests textTag-20.2 to 20.4. The -elide {} case reported in [05411ee533] is a different bug, not fixed by this.