A little enhancement to the editors line joining function.

Tue, 08 Oct 2013 19:46:25 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 08 Oct 2013 19:46:25 +0200
changeset 2994
5ae1349b8fb4
parent 2993
4933ac9daa80
child 2995
63d874899b8b

A little enhancement to the editors line joining function.

QScintilla/Editor.py file | annotate | diff | comparison | revisions
diff -r 4933ac9daa80 -r 5ae1349b8fb4 QScintilla/Editor.py
--- a/QScintilla/Editor.py	Mon Oct 07 19:57:08 2013 +0200
+++ b/QScintilla/Editor.py	Tue Oct 08 19:46:25 2013 +0200
@@ -4779,16 +4779,25 @@
         if line1Text in ["", "\r", "\n", "\r\n"]:
             return
         
+        if line0Text.rstrip("\r\n\\ \t").endswith(("'", '"')) and \
+                line1Text.lstrip().startswith(("'", '"')):
+            # merging multi line strings
+            startChars = "\r\n\\ \t'\""
+            endChars = " \t'\""
+        else:
+            startChars = "\r\n\\ \t"
+            endChars = " \t"
+        
         # determine start index
         startIndex = len(line0Text)
-        while startIndex > 0 and line0Text[startIndex - 1] in "\r\n\\ \t":
+        while startIndex > 0 and line0Text[startIndex - 1] in startChars:
             startIndex -= 1
         if startIndex == 0:
             return
         
         # determine end index
         endIndex = 0
-        while line1Text[endIndex] in " \t":
+        while line1Text[endIndex] in endChars:
             endIndex += 1
         
         self.setSelection(curLine, startIndex, curLine + 1, endIndex)

eric ide

mercurial