Tk Source Code

View Ticket
Login
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.