Tkinter: text widget predefined key bindings

Edward K. Ream edream at tds.net
Wed Aug 28 15:28:01 CEST 2002


Leo supports unlimited undo/redo, not only for "typing" cases but for all
outline operations as well.  It's not trivial, and I find it relatively easy
to extend.

The code, in a Leo outline, of course, is in leoUndo.py.  You can look at
the code by downloading version 3.5 of leo2.py from
http://sourceforge.net/project/showfiles.php?group_id=3458

You can also look at just leoUndo.py on the CVS tree at
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/leo/leo/leoUndo.py?rev=HEAD&c
ontent-type=text/vnd.viewcvs-markup
but this will be much less clear than looking at the Leo outline.

As has been stated, one must handle cut/paste and any other operation that
affects text.

The theory of operation is in the section of leoUndo.py called
<< How Leo implements unlimited undo >>
The heavy lifting is handled by the undo() and redo() routines.  External
code calls the "state routines", particularly setUndoParams().

Hope this helps.

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  edream at tds.net
Leo: Literate Editor with Outlines
Leo: http://personalpages.tds.net/~edream/front.html
--------------------------------------------------------------------






More information about the Python-list mailing list