more predictable cursor behaviour on line insert / delete
This commit is contained in:
parent
96f9475b7f
commit
8ce0a6438c
|
@ -345,7 +345,7 @@ class SyntBlock(Synt):
|
||||||
pcur.EndLine()
|
pcur.EndLine()
|
||||||
def OnInsertNewLine(syntAfter, psel):
|
def OnInsertNewLine(syntAfter, psel):
|
||||||
self.InsertLineAfter(syntAfter, None)
|
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)
|
PwButtonHidden(pcur.pwVert, "[insert new line]", None, OnInsertNewLine, pcur.dxindent)
|
||||||
for syntLine in self.rgsynt:
|
for syntLine in self.rgsynt:
|
||||||
pwKey = PwKeyHandler(pcur.pwVert, self.HandleKey)
|
pwKey = PwKeyHandler(pcur.pwVert, self.HandleKey)
|
||||||
|
@ -371,11 +371,10 @@ class SyntBlock(Synt):
|
||||||
def HandleKey(self, pwKey, pov, psel, key):
|
def HandleKey(self, pwKey, pov, psel, key):
|
||||||
if ansi.FEnter(key):
|
if ansi.FEnter(key):
|
||||||
self.InsertLineAfter(pwKey.pwChild.Value(), None)
|
self.InsertLineAfter(pwKey.pwChild.Value(), None)
|
||||||
psel.Inc(pwKey.PwParent())
|
|
||||||
return True
|
return True
|
||||||
elif key == ansi.K_DEL and pwKey.pwChild.RgpwChild()[0] == psel.PwSelected(pwKey):
|
elif key == ansi.K_DEL and pwKey.pwChild.RgpwChild()[0] == psel.PwSelected(pwKey):
|
||||||
psel.Inc(pwKey.PwParent())
|
|
||||||
self.RemoveLine(pwKey.pwChild.Value())
|
self.RemoveLine(pwKey.pwChild.Value())
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def Eval(self, env):
|
def Eval(self, env):
|
||||||
|
|
Loading…
Reference in a new issue