Skip to content

Commit

Permalink
views: Make the ALL_MESSAGES command work globally.
Browse files Browse the repository at this point in the history
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 zulip#1505.
  • Loading branch information
Niloth-p committed Jul 18, 2024
1 parent 4f15cac commit 2525a79
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions zulipterminal/ui_tools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit 2525a79

Please sign in to comment.