Skip to content

Commit 489b5e2

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 menu button commands, to work from any panel. This could not be implemented in ui.py along with other menu buttons, 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.
1 parent 4258831 commit 489b5e2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

zulipterminal/ui_tools/views.py

+15
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,11 @@ 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.controller.narrow_to_all_messages()
420+
self.view.show_left_panel(visible=False)
421+
self.view.body.focus_position = 1
422+
return key
418423
return super().keypress(size, key)
419424

420425

@@ -543,6 +548,11 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
543548
self.search_status = SearchStatus.DEFAULT
544549
self.view.controller.update_screen()
545550
return key
551+
elif is_command_key("ALL_MESSAGES", key):
552+
self.view.controller.narrow_to_all_messages()
553+
self.view.show_left_panel(visible=False)
554+
self.view.body.focus_position = 1
555+
return key
546556
return super().keypress(size, key)
547557

548558

@@ -790,6 +800,11 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
790800
self.search_status = SearchStatus.DEFAULT
791801
self.view.controller.update_screen()
792802
return key
803+
elif is_command_key("ALL_MESSAGES", key):
804+
self.view.controller.narrow_to_all_messages()
805+
self.view.show_right_panel(visible=False)
806+
self.view.body.focus_position = 1
807+
return key
793808
elif is_command_key("GO_LEFT", key):
794809
self.view.show_right_panel(visible=False)
795810
return super().keypress(size, key)

0 commit comments

Comments
 (0)