Re: Undo and the text widget

Christopher Blizzard <blizzard redhat com> writes: 
> You might want to consider breaking the undo and the text widget
> into seperate components instead of making the transaction
> management part of the editor's api.
> Is it possible to break the text widget's actions down into chunks
> that you can play forward and back?  That way you would get redo and
> undo. You could pass in something like:
> "Add" "Type" <char code> "Offset"
> "Delete" "Cut" <char code> "Offset"
> You could also use that to build macroified text actions - it lends
> itself to scriptability.  You could build the transaction manager
> around it instead of as a part of the editor.  You could also hook
> up to the key signals in the editor widget and build your own
> transactions from that instead of having a hard coded transaction
> behaviour in the editor widget.
> Sorry if this sounds a little disjointed, I'm in a meeting. :)

I think I'll need a more slow and patronizing explanation of that
before it's totally clear to me. I haven't ever implemented this type
of thing.

Right now the GtkTextBuffer object has only two real mutating
operations, which are "insert" and "delete." You might also want to
undo stuff related to tags and marks, I guess.

The higher-level operations, such as "meta-space" or "cut" are done
in the view widget instead of the buffer, using the GtkBindingSet
stuff that lets people change keybindings from a gtkrc.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]