[gnome-builder/gnome-builder-3-18] python: copy string rank indentation



commit 7d4dc32932ace006a5eb066dc145e5d1b90dc5e1
Author: Christian Hergert <christian hergert me>
Date:   Sat Oct 3 15:23:35 2015 -0700

    python: copy string rank indentation

 plugins/python-pack/python_indenter.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/plugins/python-pack/python_indenter.py b/plugins/python-pack/python_indenter.py
index cfcfe65..94386cd 100644
--- a/plugins/python-pack/python_indenter.py
+++ b/plugins/python-pack/python_indenter.py
@@ -488,6 +488,12 @@ class PythonIndenter(GObject.Object): #, Ide.Indenter):
                 suffix = '# '
             return self.copy_indent(view, iter, suffix=suffix)
 
+        # Copy the indentation for the beginning of the string if we are
+        # possibily in a multi-line string.
+        if nearest.rank == Rank.STRING:
+            indent = self.get_indent_at_visual_column(nearest.column, iter)
+            return '\n' + indent, 0
+
         if self.settings.align_params \
         and discoveries.select_tail(Rank.FUNCTION, Rank.TUPLE):
             # indent for the tuple begin position plus a space to move


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]