[gedit/wip/bug-615220] [snippets] Block cursor-moved handler while inserting snippet
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/bug-615220] [snippets] Block cursor-moved handler while inserting snippet
- Date: Sat, 12 Apr 2014 16:46:10 +0000 (UTC)
commit ef700a546242aec6edb9aaf6ae4fa40f940c922c
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Apr 12 16:30:56 2014 +0200
[snippets] Block cursor-moved handler while inserting snippet
https://bugzilla.gnome.org/show_bug.cgi?id=615220
plugins/snippets/snippets/document.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/plugins/snippets/snippets/document.py b/plugins/snippets/snippets/document.py
index ab41ecc..b51b4d6 100644
--- a/plugins/snippets/snippets/document.py
+++ b/plugins/snippets/snippets/document.py
@@ -553,6 +553,9 @@ class Document(GObject.Object, Gedit.ViewActivatable, Signals):
if current and current.__class__ == PlaceholderEnd:
self.goto_placeholder(current, None)
+ if len(self.active_snippets) > 0:
+ self.block_signal(buf, 'cursor-moved')
+
buf.begin_user_action()
# Remove the tag, selection or current word
@@ -561,6 +564,7 @@ class Document(GObject.Object, Gedit.ViewActivatable, Signals):
# Insert the snippet
if len(self.active_snippets) == 0:
self.first_snippet_inserted()
+ self.block_signal(buf, 'cursor-moved')
sn = s.insert_into(self, start)
self.active_snippets.append(sn)
@@ -576,6 +580,8 @@ class Document(GObject.Object, Gedit.ViewActivatable, Signals):
else:
self.goto_placeholder(self.active_placeholder, sn.placeholders[keys[0]])
+ self.unblock_signal(buf, 'cursor-moved')
+
if sn in self.active_snippets:
# Check if we can get end_iter in view without moving the
# current cursor position out of view
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]