Tk Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 1273358
Title: Ask a text widget for the depth of its undo and redo stacks
Type: RFE Version: None
Submitter: fvogel Created on: 2005-08-25 20:46:09
Subsystem: 18. [text] Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2016-05-30 18:09:37
Resolution: Fixed Closed By: fvogel
    Closed on: 2016-05-30 18:09:37
I would like to have a way to query the current depth of 
the undo and redo stacks of a text widget.

This would allow to enable/disable contextually Undo 
and Redo commands in applications.

Whether the undo stack is empty or not can be known 
by querying the modified flag (although this is not 
equivalent, but I can set the modified flag manually in 
such a way that it is).

I have however no solution for the redo stack depth. How 
can I know if it's zero or not? Currently I have to track 
manually any editing in my text widget, this is 
cumbersome and greatly lowers the interest of using the 
embedded .text edit commands.

In summary please add a command that gives the 
current depth of each stack, or at least a command that 
says if the depths are zero or not.

User Comments: fvogel added on 2016-05-30 18:09:37:
TIP #446 now merged to core-8-6-branch and trunk following positive vote by the TCT.

fvogel added on 2016-04-07 18:41:16:

Discussion about TIP #446 can be followed on TCLCORE.

fvogel added on 2016-04-05 18:49:46:

TIP #446 created to discuss this.