From 8ce0a6438c7805770d6359ef83cb41157c089a76 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Sat, 1 Aug 2020 23:51:42 -0400 Subject: [PATCH] more predictable cursor behaviour on line insert / delete --- scripting.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripting.py b/scripting.py index 24392cc..4e148a1 100644 --- a/scripting.py +++ b/scripting.py @@ -345,7 +345,7 @@ class SyntBlock(Synt): pcur.EndLine() def OnInsertNewLine(syntAfter, psel): self.InsertLineAfter(syntAfter, None) - psel.Inc(pcur.pwVert) # does nothing because we need to reproject + # psel.Inc(pcur.pwVert) # does nothing because we need to reproject PwButtonHidden(pcur.pwVert, "[insert new line]", None, OnInsertNewLine, pcur.dxindent) for syntLine in self.rgsynt: pwKey = PwKeyHandler(pcur.pwVert, self.HandleKey) @@ -371,11 +371,10 @@ class SyntBlock(Synt): def HandleKey(self, pwKey, pov, psel, key): if ansi.FEnter(key): self.InsertLineAfter(pwKey.pwChild.Value(), None) - psel.Inc(pwKey.PwParent()) return True elif key == ansi.K_DEL and pwKey.pwChild.RgpwChild()[0] == psel.PwSelected(pwKey): - psel.Inc(pwKey.PwParent()) self.RemoveLine(pwKey.pwChild.Value()) + return True return False def Eval(self, env):