4178: undo on note editor goes back to no text; added a reset method to styled text buffer and editor
svn: r15756
This commit is contained in:
parent
21651501ca
commit
fa09584578
@ -266,6 +266,8 @@ class EditNote(EditPrimary):
|
||||
if self.obj:
|
||||
self.empty = False
|
||||
self.texteditor.set_text(self.obj.get_styledtext())
|
||||
# Reset the undoable buffer:
|
||||
self.texteditor.reset()
|
||||
_LOG.debug("Initial Note: %s" % str(self.texteditor.get_text()))
|
||||
else:
|
||||
self.empty = True
|
||||
|
@ -382,6 +382,12 @@ class StyledTextEditor(gtk.TextView):
|
||||
open_menu.show()
|
||||
menu.prepend(open_menu)
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Reset the undoable buffer
|
||||
"""
|
||||
self.textbuffer.reset()
|
||||
|
||||
# private methods
|
||||
|
||||
def _connect_signals(self):
|
||||
|
@ -194,6 +194,15 @@ class UndoableBuffer(gtk.TextBuffer):
|
||||
toggles self.not_undoable_action"""
|
||||
self.not_undoable_action = False
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Resets buffer to initial state.
|
||||
"""
|
||||
self.undo_stack[:] = []
|
||||
self.redo_stack[:] = []
|
||||
self.not_undoable_action = False
|
||||
self.undo_in_progress = False
|
||||
|
||||
def undo(self):
|
||||
"""undo inserts or deletions
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user