From e857679ee6affccb25f9689ced4db2c7fc5cf521 Mon Sep 17 00:00:00 2001 From: Ben Connors Date: Mon, 9 Mar 2020 20:09:41 -0400 Subject: Improvements to interface - Somewhat ghetto solution to crashing when too small - Can now advance by just hitting enter --- interface/input/tabcomp.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'interface/input/tabcomp.py') 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 -- cgit v1.2.3