From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Wed, 29 Apr 2009 11:22:41 -0700 Subject: [sup-talk] redo ideas In-Reply-To: <200904271244.n3RCi1VO027803@smtp6.server.rpi.edu> References: <200904271244.n3RCi1VO027803@smtp6.server.rpi.edu> Message-ID: <1241028879-sup-6375@entry> Reformatted excerpts from Mike S's message of 2009-04-27: > I'm graduating in a few weeks, so I'll have some free time I can > dedicate to sup again. Congrats! Great! > I'd like to register Ctrl-R to keep with the vim bindings. Sure. > Ugly method 2: write code in duplicate, register a redo and call redo > This saves duplication of code, but it seems unnecessarily complex. > > * create undo lambda > * create redo lambda > * register undo and redo, but 'queue up' redo > * UndoManager.redo Redo is actually a slightly different operation from do. Do has to ask for user input (what label do you want to apply?), redo just reuses it. Maybe that's not such a big deal though; do/redo can just check to see if it already has the value from the user, and ask if not. > Slightly clever method: have primitives return their own undo/redo. > This can be seen in toggle_starred where actually_toggle_starred > returns its inverse. This shifts the complexity down and keeps higher > level code clean. That sounds eminently reasonable to me. -- William