diff options
author | Ben Connors <benconnors@outlook.com> | 2020-03-09 20:09:41 -0400 |
---|---|---|
committer | Ben Connors <benconnors@outlook.com> | 2020-03-09 20:09:41 -0400 |
commit | e857679ee6affccb25f9689ced4db2c7fc5cf521 (patch) | |
tree | dc646e92fcb033e53ab6323f6f79a63dfde9c4f2 /interface/input/tabcomp.py | |
parent | 86ada880e02e41dd97834ff40eb63628beb0c0db (diff) |
Improvements to interface
- Somewhat ghetto solution to crashing when too small
- Can now advance by just hitting enter
Diffstat (limited to 'interface/input/tabcomp.py')
-rwxr-xr-x | interface/input/tabcomp.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/interface/input/tabcomp.py b/interface/input/tabcomp.py index 7479f97..c454ad2 100755 --- a/interface/input/tabcomp.py +++ b/interface/input/tabcomp.py @@ -61,6 +61,13 @@ class Input: start = {} for i, f in ctx: + if not i: + if None in parent.children: + raise ValueError("Duplicate base command") + parent.children.append(None) + parent.f = f + continue + if isinstance(i, str): i = i.split(' ') if i[0] not in start: @@ -180,16 +187,20 @@ class Input: ## In the format: ## (input, parsed, display, is variable?) path = [["", True, "", False]] + size_ok = True while True: with self._ctx_lock: self._l1 = "".join((i[2] for i in path if i[2])) with CURSES_LOCK: - self._redraw() + if size_ok: + self._redraw() l = self.win.getch() with self._ctx_lock: if l == curses.KEY_RESIZE: if resize is not None: - resize() + size_ok = resize() + continue + if not size_ok: continue if self._context is None: continue |