more predictable cursor behaviour on line insert / delete

This commit is contained in:
Jeremy Penner 2020-08-01 23:51:42 -04:00
parent 96f9475b7f
commit 8ce0a6438c

View file

@ -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):