# HG changeset patch # User laurent # Date 1326047280 -3600 # Node ID fc03645162b56df6310373ba836b766a9bfd4f95 # Parent 6e48943e821e6cce46b4c5eb9d75a0ac9f125f1e Fixing bug in autoindent when number of spaces at the beginning of line is odd diff -r 6e48943e821e -r fc03645162b5 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()