Tk Source Code

View Ticket
Login
Ticket UUID: 3192483
Title: undo/redo not properly working
Type: Bug Version: obsolete: 8.5.9
Submitter: gcramer Created on: 2011-02-25 17:42:15
Subsystem: 18. [text] Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2011-02-26 05:13:42
Resolution: Invalid Closed By: hobbs
    Closed on: 2011-02-25 17:50:00
Description:
Try the following script:

-------------------------------------------------------------------------------------
set bold [list [font configure TkTextFont -family] [font configure TkTextFont -size] bold]
pack [text .t -font TkTextFont -undo yes]
.t tag configure bold -font $bold
.t insert insert "the last word is "
.t insert insert "bold" bold
.t insert insert "."
-------------------------------------------------------------------------------------

Now do the following:
1. Select the word "bold"
2. Delete this word (press DEL)
3. Undo the change (press Ctrl-z)

After the undo the word "bold" has the wrong font. The undo/redo mechanism should regard the tags, otherwise the result is wrong. E.g in my application I'm using special fonts with the use of tags. If I enter a special symbol "\u0001" of this font (with the appropriate tag), after delete & undo this symbol will be shown with the wrong font, that means it is the wrong text (garbage in this case).
User Comments: gcramer added on 2011-02-26 05:13:42:
Bad, the current undo/redo mechanism is quite useless.

hobbs added on 2011-02-26 00:50:00:
Although not clear enough in the docs, the undo mechanism only handles insert/delete operations - not tag operations.  Could use to update the docs to note this more clearly.