-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Improve display of "esc" keybinding in the keybindings status bar #4819
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
Improve display of "esc" keybinding in the keybindings status bar #4819
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
This is not ready for review yet, we can do a lot better still. Working on it. |
95e463c
to
cc235c6
Compare
@kyu08 This is ready for review now. If you have time to review this again (and/or test it a bit), that would be great, thanks! |
@kyu08 Does the thumb-up mean that you are going to review it, or that you did and think it's ok? That wasn't quite clear. |
Sorry for that unclear response. |
bc5d767
to
74ada8e
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.
LGTM.
I read your changes and tried using this branch. This PR improves the UX of lazygit.
- The context dependent descriptions for
esc
key improves ease of understanding(e.g. before:Cancel: <esc>
, after:Abort rebase: <esc>
).- It become clearer what would happen to press the key.
- Also, I feel moving
esc
before?
is important change because sometimes width is not enough to show all keybindings as you said in fabe734.
Thanks for doing better work than my PR. 👏
… view It's maybe not totally obvious, so let's show it. Esc now appears twice in the status bar, because the global controller also appends its generic "Cancel". We'll fix this in the next commit.
Sometimes there is a local and a global keybinding for the same key; if both are configured to be shown in the options map, we should only show the local one because it takes precedence. This happens for example for <esc> in a popup, or for <esc> in the focused main view. Note that this is also a problem in the keybindings menu, and we don't solve that here.
Cancelling searching (as opposed to filtering) is handled by gocui.
The code duplication between Escape and EscapeEnabled is unfortunate, but I don't see a better way to solve this.
It is styled and includes a "(Reset)" button, so it's really not a general-purpose description, but very specific to the Information view.
WHen several modes are active at the same time, it isn't totally obvious which one will be cancelled first, so show this in the status bar.
The main reason for this is that sometimes the escape key is handled by a local binding, in which case it appears before the '?' binding in the options status bar, and other times it is handled by the global controller, in which case it appeared after. Moving it to before the keybindings menu handler makes it appear before '?' in both cases. Also, if the window is too narrow to show all keybindings, the ones that don't fit will be truncated, and in this case it is more important to show the esc binding because of its context sensitivity. This also moves the esc entry up a few positions in the keybindings menu, but I don't think this matters much.
…view Dismissing a range selection is handled by the global escape handler for all list views, but not for the staging and patch building views, so we need to make the esc description dynamic for these, too.
For many menus, just "Close" is fine, but some menus act more like confirmations (e.g. the menu that appears when you cherry-pick and get conflicts); in this case, it's good to make it more obvious that hitting esc cancels the whole thing.
In some cases we set a disabled reason but leave the text empty, so that we don't get an error toast when the item is invoked. In such a case it looks awkward if there is a tooltip showing "Disabled: " with no following text.
74ada8e
to
da7121f
Compare
PR Description
Confirm: <enter> | Close/Cancel: <esc> | Cancel: <esc>
. Omit the second<esc>
.<esc>
binding in other views when it doesn't do anything.<esc>
label to show what it does, based on context. This is very helpful because esc can cancel all sorts of things, and if several of these things are active at once, it is not obvious which one will be cancelled first.Supersedes #4808.