[gedit] Make Ctrl/Shift navigation more similar to tree navigation behavior
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: svn-commits-list gnome org
- Subject: [gedit] Make Ctrl/Shift navigation more similar to tree navigation behavior
- Date: Tue, 26 May 2009 04:44:34 -0400 (EDT)
commit 9ffadadc9111efc4568fbf9724baf93fb6332dc7
Author: Jesse van den Kieboom <jvanden grijpc10 epfl ch>
Date: Tue May 26 10:44:25 2009 +0200
Make Ctrl/Shift navigation more similar to tree navigation behavior
---
plugins/quickopen/quickopen/popup.py | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/plugins/quickopen/quickopen/popup.py b/plugins/quickopen/quickopen/popup.py
index 3c6dd1f..6ab7115 100644
--- a/plugins/quickopen/quickopen/popup.py
+++ b/plugins/quickopen/quickopen/popup.py
@@ -45,6 +45,7 @@ class Popup(gtk.Dialog):
self._cache = {}
self._theme = None
self._cursor = None
+ self._shift_start = None
accel_group = gtk.AccelGroup()
accel_group.connect_group(gtk.keysyms.l, gtk.gdk.CONTROL_MASK, 0, self.on_focus_entry)
@@ -341,22 +342,38 @@ class Popup(gtk.Dialog):
self.do_search()
self.on_selection_changed(self._treeview.get_selection())
+ def _shift_extend(self, towhere):
+ selection = self._treeview.get_selection()
+
+ if not self._shift_start:
+ model, rows = selection.get_selected_rows()
+ start = rows[0]
+
+ self._shift_start = gtk.TreeRowReference(self._store, start)
+ else:
+ start = self._shift_start.get_path()
+
+ selection.unselect_all()
+ selection.select_range(start, towhere)
+
def _select_index(self, idx, hasctrl, hasshift):
path = (idx,)
if not (hasctrl or hasshift):
self._treeview.get_selection().unselect_all()
- if (not hasctrl) or hasshift:
- if self._cursor:
- self._treeview.get_selection().select_path(self._cursor.get_path())
- else:
+ if hasshift:
+ self._shift_extend(path)
+ else:
+ self._shift_start = None
+
+ if not hasctrl:
self._treeview.get_selection().select_path(path)
self._treeview.scroll_to_cell(path, None, True, 0.5, 0)
self._remove_cursor()
- if hasctrl:
+ if hasctrl or hasshift:
self._cursor = gtk.TreeRowReference(self._store, path)
piter = self._store.get_iter(path)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]