22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 |
25 |
26 from __future__ import absolute_import |
26 from __future__ import absolute_import |
|
27 from __future__ import division |
27 import re |
28 import re |
28 from types import * |
29 from types import * |
29 |
30 |
30 import wx |
31 import wx |
31 import wx.stc |
32 import wx.stc |
891 key_handled = True |
892 key_handled = True |
892 elif key == wx.WXK_RETURN or key == wx.WXK_NUMPAD_ENTER: |
893 elif key == wx.WXK_RETURN or key == wx.WXK_NUMPAD_ENTER: |
893 if self.TextSyntax in ["ST", "ALL"]: |
894 if self.TextSyntax in ["ST", "ALL"]: |
894 indent = self.Editor.GetLineIndentation(line) |
895 indent = self.Editor.GetLineIndentation(line) |
895 if LineStartswith(lineText.strip(), self.BlockStartKeywords): |
896 if LineStartswith(lineText.strip(), self.BlockStartKeywords): |
896 indent = (indent / 2 + 1) * 2 |
897 indent = (indent // 2 + 1) * 2 |
897 self.Editor.AddText("\n" + " " * indent) |
898 self.Editor.AddText("\n" + " " * indent) |
898 key_handled = True |
899 key_handled = True |
899 elif key == wx.WXK_BACK: |
900 elif key == wx.WXK_BACK: |
900 if self.TextSyntax in ["ST", "ALL"]: |
901 if self.TextSyntax in ["ST", "ALL"]: |
901 if not self.Editor.GetSelectedText(): |
902 if not self.Editor.GetSelectedText(): |
902 indent = self.Editor.GetColumn(self.Editor.GetCurrentPos()) |
903 indent = self.Editor.GetColumn(self.Editor.GetCurrentPos()) |
903 if lineText.strip() == "" and len(lineText) > 0 and indent > 0: |
904 if lineText.strip() == "" and len(lineText) > 0 and indent > 0: |
904 self.Editor.DelLineLeft() |
905 self.Editor.DelLineLeft() |
905 self.Editor.AddText(" " * ((max(0, indent - 1) / 2) * 2)) |
906 self.Editor.AddText(" " * ((max(0, indent - 1) // 2) * 2)) |
906 key_handled = True |
907 key_handled = True |
907 if not key_handled: |
908 if not key_handled: |
908 event.Skip() |
909 event.Skip() |
909 else: |
910 else: |
910 event.Skip() |
911 event.Skip() |