[gnome-builder] python: work our way back to beginning of context
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] python: work our way back to beginning of context
- Date: Sat, 3 Oct 2015 22:29:30 +0000 (UTC)
commit 3d6ba0d0a245579e0d8298f8666069a7d1cf95ec
Author: Christian Hergert <christian hergert me>
Date: Sat Oct 3 15:23:06 2015 -0700
python: work our way back to beginning of context
We could probably use tag toggles here like GtkSourceView does, but those
start to get really complex when dealing with pydoc and such.
plugins/python-pack/python_indenter.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/plugins/python-pack/python_indenter.py b/plugins/python-pack/python_indenter.py
index 84af22f..cfcfe65 100644
--- a/plugins/python-pack/python_indenter.py
+++ b/plugins/python-pack/python_indenter.py
@@ -242,6 +242,11 @@ class Discoveries:
if not iter.starts_line():
iter.backward_char()
if self.buffer.iter_has_context_class(iter, word):
+ while self.buffer.iter_has_context_class(iter, word):
+ if not iter.backward_char():
+ break
+ if not self.buffer.iter_has_context_class(iter, word):
+ iter.forward_char()
self._add(rank, iter)
def _discover_string(self, iter, stop, *, word='string', rank=Rank.STRING):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]