Janky line delete
This commit is contained in:
parent
31ab88ab6c
commit
0d83da70ae
30
scripting.py
30
scripting.py
|
@ -353,11 +353,17 @@ class SyntBlock(Synt):
|
|||
syntStmt.syntParent = self
|
||||
return syntStmt
|
||||
|
||||
def RemoveLine(self, synt):
|
||||
self.rgsynt.remove(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 False
|
||||
|
||||
def Eval(self, env):
|
||||
|
@ -738,8 +744,6 @@ class PwBlock(PwContainer):
|
|||
return psel.Dec(self)
|
||||
elif key == ansi.K_DOWN:
|
||||
return psel.Inc(self)
|
||||
elif key == ansi.K_DEL:
|
||||
pass
|
||||
return False
|
||||
|
||||
class PwDropdown(PwBlock):
|
||||
|
@ -866,13 +870,27 @@ class Psel(TPrs):
|
|||
return True
|
||||
return False
|
||||
|
||||
def CLevelChild_PwRoot(self, pw):
|
||||
clevelChild = 1
|
||||
while pw.PwParent() != None:
|
||||
clevelChild = clevelChild + 1
|
||||
pw = pw.PwParent()
|
||||
return (clevelChild, pw)
|
||||
|
||||
def PwRoot(self, pw):
|
||||
return self.CLevelChild_PwRoot(pw)[1]
|
||||
|
||||
def Value(self, pwRoot):
|
||||
pwRoot = self.PwRoot(pwRoot)
|
||||
self.Validate(pwRoot)
|
||||
if len(self.rgo_ipw) > 0:
|
||||
return self.rgo_ipw[-1][0]
|
||||
return None
|
||||
|
||||
def PwSelected(self, pwRoot, clevel = None):
|
||||
def PwSelected(self, pw, clevel = None):
|
||||
clevelChild, pwRoot = self.CLevelChild_PwRoot(pw)
|
||||
if clevel is not None:
|
||||
clevel = clevel + clevelChild - 1
|
||||
self.Validate(pwRoot)
|
||||
return self.PwSelectedI(pwRoot, self.rgo_ipw[:clevel])
|
||||
|
||||
|
@ -887,11 +905,7 @@ class Psel(TPrs):
|
|||
return self.ChangeI(pwContainer, IoDec)
|
||||
|
||||
def ChangeI(self, pwContainer, fnChange):
|
||||
clevelChild = 1
|
||||
pwRoot = pwContainer
|
||||
while pwRoot.PwParent() != None:
|
||||
clevelChild = clevelChild + 1
|
||||
pwRoot = pwRoot.PwParent()
|
||||
clevelChild, pwRoot = self.CLevelChild_PwRoot(pwContainer)
|
||||
self.Validate(pwRoot)
|
||||
assert self.PwSelected(pwRoot, clevelChild).PwParent() == pwContainer
|
||||
|
||||
|
|
Loading…
Reference in a new issue