aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-09-20 20:41:27 +0200
committerMattias Andrée <maandree@operamail.com>2013-09-20 20:41:27 +0200
commit8cb264e804ee160a8332284a87e5cb51d987a022 (patch)
tree2070ec3430ae42db507f46f4d226e0ea93c3e4b0
parentwrapping complete, but not history tracking implemented (diff)
downloadpytagomacs-8cb264e804ee160a8332284a87e5cb51d987a022.tar.gz
pytagomacs-8cb264e804ee160a8332284a87e5cb51d987a022.tar.bz2
pytagomacs-8cb264e804ee160a8332284a87e5cb51d987a022.tar.xz
todos
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/editor.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/editor.py b/src/editor.py
index f1007b1..2f1898b 100644
--- a/src/editor.py
+++ b/src/editor.py
@@ -51,18 +51,22 @@ _yank, _yank_cycle, _move_point = Line.yank, Line.yank_cycle, Line.move_point
_swap_mark, _override = Line.swap_mark, Line.override
## Editing methods to wrap for undo history
-def break_edit(self, func):
- return func(self)
-
def full_edit(self, func):
- return func(self)
+ # TODO commit changes, if any
+ rc = func(self)
+ # TODO commit changes, if any
+ # TODO reset
+ return rc
def partial_edit(self, func, with_return = True):
+ # TODO commit changes, if any, if one second has elapsed, and then reset
if with_return:
return func(self)
else:
func(self)
+break_edit = lambda self, func : full_edit(self, func)
+
Line.copy = lambda self : break_edit(self, _copy)
Line.cut = lambda self : full_edit(self, _cut)
Line.kill = lambda self : full_edit(self, _kill)
@@ -357,6 +361,7 @@ class TextArea():
elif d == ctrl('Y'): edit(lambda L : L.yank(), _('Killring is empty'))
elif d == ctrl('R'): self.editring.change_direction()
elif d in (ctrl('_'), ctrl('U')):
+ ## TODO history break
if self.editring.is_empty():
self.alert(_('Nothing to undo'))
else: