Linking undo history between multiple GtkSourceViews
I have an application which contains several GtkSourceView widgets. The main interface is a sheet containing multiple "cells" - each a GtkSourceView. GtkSourceView has built-in support for undo开发者_Go百科, but each widget has its own "undo stack." I'd like to have the same undo stack across the entire sheet.
For example: Say the last edit was made in SourceView A and the second to last edit was in SourceView B. Regardless of which SourceView has the focus, the first press Ctrl-Z should revert the change in A, and the second press should revert the change in B.
Is there a way I can accomplish this while still keeping multiple SourceView widgets, or am I better off trying to implement this type of undo functionality myself?
Note: I think it'd be too clunky to try to have the entire sheet inside a single SourceView. Also, I'm using Python.
Yes, bind the Ctrl-Z hotkey to your own Undo menu item, in which you keep track of the order in which the sourceviews were changed, and call the undo method on the appropriate sourceview.
精彩评论