Fixing bug in autoindent when number of spaces at the beginning of line is odd
authorlaurent
Sun, 08 Jan 2012 19:28:00 +0100
changeset 619 fc03645162b5
parent 618 6e48943e821e
child 620 f0232cd1628d
Fixing bug in autoindent when number of spaces at the beginning of line is odd
TextViewer.py
--- a/TextViewer.py	Sun Jan 08 19:22:26 2012 +0100
+++ b/TextViewer.py	Sun Jan 08 19:28:00 2012 +0100
@@ -767,7 +767,7 @@
                 if self.TextSyntax in ["ST", "ALL"]:
                     indent = self.Editor.GetLineIndentation(line)
                     if LineStartswith(lineText.strip(), self.BlockStartKeywords):
-                        indent += 2
+                        indent = (indent / 2 + 1) * 2
                     self.Editor.AddText("\n" + " " * indent)
                     key_handled = True
             elif key == wx.WXK_BACK:
@@ -775,7 +775,7 @@
                     indent = self.Editor.GetLineIndentation(line)
                     if lineText.strip() == "" and indent > 0:
                         self.Editor.DelLineLeft()
-                        self.Editor.AddText(" " * max(0, indent - 2))
+                        self.Editor.AddText(" " * ((max(0, indent - 1) / 2) * 2))
                         key_handled = True
             if not key_handled:
                 event.Skip()