Skip to content

Commit 1e57902

Browse files
committed
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.
1 parent a6aae3e commit 1e57902

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

zulipterminal/ui_tools/views.py

+8
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
415415
self.search_status = SearchStatus.DEFAULT
416416
self.view.controller.update_screen()
417417
return key
418+
elif is_command_key("ALL_MESSAGES", key):
419+
self.view.home_button.activate(key)
418420
return super().keypress(size, key)
419421

420422

@@ -543,6 +545,8 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
543545
self.search_status = SearchStatus.DEFAULT
544546
self.view.controller.update_screen()
545547
return key
548+
elif is_command_key("ALL_MESSAGES", key):
549+
self.view.home_button.activate(key)
546550
return super().keypress(size, key)
547551

548552

@@ -790,6 +794,8 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
790794
self.search_status = SearchStatus.DEFAULT
791795
self.view.controller.update_screen()
792796
return key
797+
elif is_command_key("ALL_MESSAGES", key):
798+
self.view.home_button.activate(key)
793799
elif is_command_key("GO_LEFT", key):
794800
self.view.show_right_panel(visible=False)
795801
return super().keypress(size, key)
@@ -949,6 +955,8 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
949955
return key
950956
elif is_command_key("GO_RIGHT", key):
951957
self.view.show_left_panel(visible=False)
958+
elif is_command_key("ALL_MESSAGES", key) and self.get_focus() is self.menu_v:
959+
self.view.home_button.activate(key)
952960
return super().keypress(size, key)
953961

954962

0 commit comments

Comments
 (0)