-
-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add title-to-title scroll feature to Help Menu #1527
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! @Niloth-p 👍
Just requires a rebase to fix conflicts. The intention seems clear.
Add 2 new commands to refocus to view the previous/next help category section. Hotkeys linting exclusion updated. Hotkeys document regenerated.
4af72e4
to
1b0d374
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally this seems to work fine. Also I personally like these two keys. So if we decide it's something to add (the Zulip thread doesn't have a definitive answer to that question yet), this could be the way to go.
I have left some comments, they are a bit more like "questions" than answers unfortunately, I'd be happy to help looking for answers. Gist is that I think the code can be iterated on a bit.
Also, did you consider writing tests? ("yes, but decided against them because it's too tricky" is a valid answer)
'GO_TO_PREVIOUS_TITLE': { | ||
'keys': ['p'], | ||
'help_text': 'Go to previous help category', | ||
'key_category': 'navigation', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether navigation
is a good category for this, but I don't see a better one either. The problem I see is that the two new commands are very specific to the "Help" popup while the other ones seem to be more generic. In that sense the new commands seem to be a bit similar to "Show/hide user information (from user list)": It could also be "Go to previous category (in Help Menu)" or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also wondering whether it's useful to put hints towards those keys in the headline of the popup. It probably will get a bit crowded there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, see the linked topic for some discussion. The keys aren't critical here, but my thoughts would be to use ones that
- don't clash with existing more-global key use (like
n
&p
; so don't need to remember context) - more easily translate to use more globally in the UI (reuse/memorization; can apply to other vertical sectioned lists)
- have relative movement (like these, but not eg. numbered points to jump to)
Some options I raised were perhaps tab/shift-tab
(depending on usage of that elsewhere), and various matching parentheses such as (
/)
, or ]
, or }
.
last_help_entry = len(self.log) - 1 | ||
if last_help_entry > last_visible_position: | ||
for category_start_position in self.category_start_positions: | ||
if category_start_position > focus_position: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My LSP (I think) shows me a type error here. I think this file is not typed, so the CI passes on github. The error is:
Operator ">" not supported for types "int" and "Unknown | None"
Operator ">" not supported for types "int" and "None"
Which might be caused by the previous # type: ignore[misc]
. I would be curious if there's a way to make mypy happy without the ignore
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, I think this was caused by using a later version of Urwid here.
@@ -1261,6 +1261,33 @@ def __init__(self, controller: Any, title: str) -> None: | |||
|
|||
super().__init__(controller, widgets, "HELP", popup_width, title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's mainly independent of this PR, but it seems a bit strange to me to have a super().__init__
call in the middle of a constructor. I would have expected it at the start of the constructor, but that doesn't seem to be a pattern in Zulip Terminal.
It seems that the general pattern is to have the super init at the end. But now that the setup code for category_start_positions
relies on the parent to be initialized it lands in the middle.
Nevertheless I'd be curious if that's also something we can prevent, maybe by putting the responsibility for the category positions to the parent or something.
@Niloth-p For some more direct feedback here, this looks to work OK, though I've not reviewed the code as there are other PRs underway! Points to consider:
Right now this works well separately from scrolling, but including that it gets confused - at least if the intention is to have a category title visible at the top? (on each title-to-title, except if the bottom is not 'aligned') |
What does this PR do, and why?
Adds 2 new commands to refocus to view the previous/next help category section.
Hotkeys linting exclusion updated.
Hotkeys document regenerated.
Why?
This could be helpful when we have several help menu sections.
Outstanding aspect(s)
This merely adds the functionality. The prompting for the user can be improved.
exclude_from_help_menu
to remove entries like these from being listed in the help menu. Currently, these are probably the only 2 commands that may need to be removed from the help menu, but with the addition of contexts, there may be more.External discussion & connections
New hotkeys to scroll title-to-title in Help Menu #T1527
How did you test this?
Self-review checklist for each commit