From f02718befc0f65350a90acc636106d8f9377c252 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Sat, 01 May 2010 15:10:42 +0000 Subject: Make multi edit keybinding toggle multi edit mode --- diff --git a/plugins/multiedit/multiedit/documenthelper.py b/plugins/multiedit/multiedit/documenthelper.py index 44937a8..58ccac7 100644 --- a/plugins/multiedit/multiedit/documenthelper.py +++ b/plugins/multiedit/multiedit/documenthelper.py @@ -138,13 +138,24 @@ class DocumentHelper(Signals): for handler in self._event_handlers: handler[0] = map(lambda x: gtk.gdk.keyval_from_name(x), handler[0]) + def disable_multi_edit(self): + if self._column_mode: + self._cancel_column_mode() + + self._in_mode = False + + self._view.set_border_window_size(gtk.TEXT_WINDOW_TOP, 0) + self.remove_edit_points() + def enable_multi_edit(self): self._view.set_border_window_size(gtk.TEXT_WINDOW_TOP, 20) + self._in_mode = True + def toggle_multi_edit(self): if self._in_mode: - return - - self._in_mode = True + self.disable_multi_edit() + else: + self.enable_multi_edit() def remove_edit_points(self): buf = self._buffer @@ -156,15 +167,6 @@ class DocumentHelper(Signals): self._multi_edited = False self._view.queue_draw() - def disable_multi_edit(self): - if self._column_mode: - self._cancel_column_mode() - - self._in_mode = False - - self._view.set_border_window_size(gtk.TEXT_WINDOW_TOP, 0) - self.remove_edit_points() - def do_escape_mode(self, event): if self._column_mode: self._cancel_column_mode() diff --git a/plugins/multiedit/multiedit/windowhelper.py b/plugins/multiedit/multiedit/windowhelper.py index 63ac0ef..d9941ae 100644 --- a/plugins/multiedit/multiedit/windowhelper.py +++ b/plugins/multiedit/multiedit/windowhelper.py @@ -115,6 +115,6 @@ class WindowHelper(Signals): helper = view.get_data(constants.DOCUMENT_HELPER_KEY) if helper != None: - helper.enable_multi_edit() + helper.toggle_multi_edit() # ex:ts=4:et: -- cgit v0.8.3.1