blob: b7c8e5a5502080c93bba2fb30467a0f40cb055f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
From f02718befc0f65350a90acc636106d8f9377c252 Mon Sep 17 00:00:00 2001
From: Jesse van den Kieboom <jesse@icecrew.nl>
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
|