aboutsummaryrefslogtreecommitdiffstats
path: root/src/featherweight.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-07-26 11:12:36 +0200
committerMattias Andrée <maandree@operamail.com>2013-07-26 11:12:36 +0200
commitfcf0496c93e48a7ba299fcfa634a52743d06c490 (patch)
tree4aba597f78eb608220c040896cb015e15a4ee80f /src/featherweight.py
parenttree walking (diff)
downloadpytagomacs-fcf0496c93e48a7ba299fcfa634a52743d06c490.tar.gz
pytagomacs-fcf0496c93e48a7ba299fcfa634a52743d06c490.tar.bz2
pytagomacs-fcf0496c93e48a7ba299fcfa634a52743d06c490.tar.xz
fix tree walking
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/featherweight.py')
-rwxr-xr-xsrc/featherweight.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/featherweight.py b/src/featherweight.py
index b3b35eb..dace6fd 100755
--- a/src/featherweight.py
+++ b/src/featherweight.py
@@ -161,17 +161,20 @@ try:
if backup is not None:
select_stack[:] = backup
elif buf.endswith('\033[1;5B'):
- if select_stack[-1][0] is not None:
- while len(select_stack) > 1:
- cur = select_stack[-1][0]
- curi = select_stack[-1][1]
- par = select_stack[-2][0]
- par = feeds if par is None else par['inner']
+ while select_stack[-1][0] is not None:
+ cur = select_stack[-1][0]
+ curi = select_stack[-1][1]
+ par = select_stack[-2][0]
+ par = feeds if par is None else par['inner']
+ if curi + 1 < len(par):
select_stack.pop()
- if curi + 1 < len(par):
- select_stack.append((par[curi + 1], curi + 1))
- print_tree()
- break
+ select_stack.append((par[curi + 1], curi + 1))
+ print_tree()
+ break
+ elif select_stack[-2][0] is not None:
+ select_stack.pop()
+ else:
+ break
elif buf.endswith('\033[C'):
if select_stack[-1][0] is None:
if len(feeds) > 0: