From f21f085d20def762d213bf87b512c2dec025c297 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sat, 19 Dec 2015 12:29:16 -0800 Subject: [PATCH] Fix multi-key handling at top level The example for multi-key handling, setting quit to ":q", did not work because the key buffer clearing at the project screen was interfering with the key buffering for unhandled input at the top level. Correct this by only clearing the keybuffer in the project screen if that screen handled a command. Otherwise, let the unhandled input handler clear it if necessary. Change-Id: I104141ceaa87e6178ca74467a55cb7a944ad0128 --- gertty/view/project_list.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gertty/view/project_list.py b/gertty/view/project_list.py index 0537a1b..da67d32 100644 --- a/gertty/view/project_list.py +++ b/gertty/view/project_list.py @@ -156,16 +156,22 @@ class ProjectListView(urwid.WidgetWrap): key = super(ProjectListView, self).keypress(size, key) keys = self.app.input_buffer + [key] commands = self.app.config.keymap.getCommands(keys) - if not self.app.input_buffer and keymap.FURTHER_INPUT not in commands: - self.app.clearInputBuffer() + ret = self.handleCommands(commands) + if ret is True: + if keymap.FURTHER_INPUT not in commands: + self.app.clearInputBuffer() + return None + return key + + def handleCommands(self, commands): if keymap.TOGGLE_LIST_REVIEWED in commands: self.unreviewed = not self.unreviewed self.refresh() - return None + return True if keymap.TOGGLE_LIST_SUBSCRIBED in commands: self.subscribed = not self.subscribed self.refresh() - return None + return True if keymap.TOGGLE_SUBSCRIBED in commands: if not len(self.listbox.body): return None @@ -180,5 +186,6 @@ class ProjectListView(urwid.WidgetWrap): self.app.sync.submitTask( sync.SyncSubscribedProjectsTask(sync.HIGH_PRIORITY)) self.app.status.update() - return None - return key + self.refresh() + return True + return False