From 2525a798f4b485d17e0512493ba362cf1cbc1e98 Mon Sep 17 00:00:00 2001 From: Niloth-p <20315308+Niloth-p@users.noreply.github.com> Date: Thu, 6 Jun 2024 06:53:08 +0530 Subject: [PATCH] views: Make the ALL_MESSAGES command work globally. This command worked only when a message was selected, using it as an anchor to fetch messages. Now, it has been made consistent with the other narrow commands, to work from any panel. This could not be implemented in ui.py along with other narrow commands, because of the conflict caused by the Esc key also being assigned to reset search in the side panels (GO_BACK command). When both operations, 1. reset search in the current panel view 2. narrow to all messages are possible, pressing `Esc` is set to trigger only the reset search operation and not the ALL_MESSAGES command. The next keypress of `Esc` will go to the home view once the current panel view is restored to its default state. Fixes #1505. --- zulipterminal/ui_tools/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zulipterminal/ui_tools/views.py b/zulipterminal/ui_tools/views.py index 6db731e016..776cdaa387 100644 --- a/zulipterminal/ui_tools/views.py +++ b/zulipterminal/ui_tools/views.py @@ -415,6 +415,8 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]: self.search_status = SearchStatus.DEFAULT self.view.controller.update_screen() return key + elif is_command_key("ALL_MESSAGES", key): + self.view.home_button.activate(key) return super().keypress(size, key) @@ -543,6 +545,8 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]: self.search_status = SearchStatus.DEFAULT self.view.controller.update_screen() return key + elif is_command_key("ALL_MESSAGES", key): + self.view.home_button.activate(key) return super().keypress(size, key) @@ -790,6 +794,8 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]: self.search_status = SearchStatus.DEFAULT self.view.controller.update_screen() return key + elif is_command_key("ALL_MESSAGES", key): + self.view.home_button.activate(key) elif is_command_key("GO_LEFT", key): self.view.show_right_panel(visible=False) return super().keypress(size, key) @@ -949,6 +955,8 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]: return key elif is_command_key("GO_RIGHT", key): self.view.show_left_panel(visible=False) + elif is_command_key("ALL_MESSAGES", key) and self.get_focus() is self.menu_v: + self.view.home_button.activate(key) return super().keypress(size, key)