[gedit/wip/bug-612663] [snippets] Deactivate snippet when collapsed
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/bug-612663] [snippets] Deactivate snippet when collapsed
- Date: Sat, 12 Apr 2014 16:46:43 +0000 (UTC)
commit f385be72a5686973cc2c5fb2d52486285857fc99
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Apr 12 17:11:42 2014 +0200
[snippets] Deactivate snippet when collapsed
This removes the snippet as soon as the begin and end
markers of the snippet have collapsed onto each other
https://bugzilla.gnome.org/show_bug.cgi?id=612663
plugins/snippets/snippets/document.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/plugins/snippets/snippets/document.py b/plugins/snippets/snippets/document.py
index ab41ecc..cd9e842 100644
--- a/plugins/snippets/snippets/document.py
+++ b/plugins/snippets/snippets/document.py
@@ -764,6 +764,14 @@ class Document(GObject.Object, Gedit.ViewActivatable, Signals):
self.update_snippet_contents)
def on_buffer_changed(self, buf):
+ for snippet in list(self.active_snippets):
+ begin = snippet.begin_iter()
+ end = snippet.end_iter()
+
+ if begin.compare(end) >= 0:
+ # Begin collapsed on end, just remove it
+ self.deactivate_snippet(snippet)
+
current = self.current_placeholder()
if current:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]