zulip / zulip-terminal

Official Zulip terminal client.
Apache License 2.0
628 stars 243 forks source link

Improve handling of narrows (views) with no messages #1506

Open neiljp opened 3 months ago

neiljp commented 3 months ago

Bug description

When selecting a new narrow (view) to show, via a hotkey, a button in either side panel, or using the message search (via /), the message focus changes to a message in the resulting view.

When the message list for that narrow/view is empty, ie. no messages are found, there is no visible message to gain focus, and the UI behaves strangely.

This can occur for many narrows/views, including:

This results in

It is possible to navigate out of this state by moving sideways and down (#580), or using one of the 'global' hotkeys such as w or q, P/#/f (though not a). However, these are workarounds.

This has been discussed variously in #zulip-terminal, and in at least the above linked issues, as well as early work on it in #278.

What did you expect to happen?

Certainly:

In addition:

1) Unlike the web app, we expect the focus to move somewhere after a new narrow is requested, so a placeholder in the message list may be the easiest short-term solution to use.

This was worked on historically in #278 as a fix for #259, where a 'fake message' was used as a placeholder. However, as demonstrated by the more complex logic we now support for searching/filtering the side panels, it should be reasonable to support a custom element for 'no results found' to be shown instead.

Even so, that solution would need to support various cases where messages 'arrive' in that empty narrow, and the placeholder is replaced by them.

2) Alternatively, focus could be retained in the previous location, if the resulting narrow is found to be empty. This would be convenient for message searches, where an empty set of results might be reasonably expected by a user to leave the focus in the search box to adjust the search.

3) Some combination of (1) and (2), since

Notes

Niloth-p commented 1 month ago

Adding a few more related aspects.

Edit: The bot issue is filed as #895.