fix inheritance bug in undo/redo code
svn: r15836
This commit is contained in:
parent
a1ec3e54b8
commit
fe311affb2
@ -36,6 +36,7 @@ class Stack(list):
|
|||||||
"""
|
"""
|
||||||
Very simple stack implementation that cannot grow beyond an at init
|
Very simple stack implementation that cannot grow beyond an at init
|
||||||
determined size.
|
determined size.
|
||||||
|
Inherits from list.
|
||||||
Only append checks if this is really the case!
|
Only append checks if this is really the case!
|
||||||
"""
|
"""
|
||||||
def __init__(self, stack_size=None):
|
def __init__(self, stack_size=None):
|
||||||
@ -108,7 +109,7 @@ class UndoableBuffer(gtk.TextBuffer):
|
|||||||
def can_redo(self):
|
def can_redo(self):
|
||||||
return bool(self.redo_stack)
|
return bool(self.redo_stack)
|
||||||
|
|
||||||
def __empty_redo_stack(self):
|
def _empty_redo_stack(self):
|
||||||
self.redo_stack = []
|
self.redo_stack = []
|
||||||
|
|
||||||
def on_insert_text_undoable(self, textbuffer, text_iter, text, length):
|
def on_insert_text_undoable(self, textbuffer, text_iter, text, length):
|
||||||
@ -131,7 +132,7 @@ class UndoableBuffer(gtk.TextBuffer):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
if not self.undo_in_progress:
|
if not self.undo_in_progress:
|
||||||
self.__empty_redo_stack()
|
self._empty_redo_stack()
|
||||||
if self.not_undoable_action:
|
if self.not_undoable_action:
|
||||||
return
|
return
|
||||||
undo_action = self.insertclass(text_iter, text, length, textbuffer)
|
undo_action = self.insertclass(text_iter, text, length, textbuffer)
|
||||||
@ -177,7 +178,7 @@ class UndoableBuffer(gtk.TextBuffer):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
if not self.undo_in_progress:
|
if not self.undo_in_progress:
|
||||||
self.__empty_redo_stack()
|
self._empty_redo_stack()
|
||||||
if self.not_undoable_action:
|
if self.not_undoable_action:
|
||||||
return
|
return
|
||||||
undo_action = self.deleteclass(text_buffer, start_iter, end_iter)
|
undo_action = self.deleteclass(text_buffer, start_iter, end_iter)
|
||||||
|
@ -96,7 +96,7 @@ class UndoableStyledBuffer(StyledTextBuffer):
|
|||||||
|
|
||||||
def on_tag_insert_undoable(self, buffer, tag, start, end):
|
def on_tag_insert_undoable(self, buffer, tag, start, end):
|
||||||
if not self.undo_in_progress:
|
if not self.undo_in_progress:
|
||||||
self.__empty_redo_stack()
|
self._empty_redo_stack()
|
||||||
if self.not_undoable_action:
|
if self.not_undoable_action:
|
||||||
return
|
return
|
||||||
if end.get_offset() - start.get_offset() == 1:
|
if end.get_offset() - start.get_offset() == 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user