-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix assigning custom key to pullFiles command in the Commits panel #4617
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
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
|
Adaptions are for this gocui commit: Cleanup: remove Is* error functions - Use errors.Is instead of quality comparisons. This is better because it matches wrapped errors as well, which we will need later in this branch. - Inline the errors.Is calls at the call sites. This is idiomatic go, we don't need helper functions for this. See https://go.dev/blog/go1.13-errors for more about this.
There was no reason to declare a variable for disabledReason, assign it inside the "if binding.GetDisabledReason != nil" statement, and then check its value again after that if statement. Move all that code inside the first if statement to make the control flow easier to understand.
If a DisabledReason has its AllowFurtherDispatching flag set, it is returned as a ErrKeybindingNotHandled error, instead of shown as a toast right away. This allows gocui to continue to dispatch the keybinding, and we can unwrap the error at the other end (in our global ErrorHandler) and display it then. This allows having keybindings for the same key at the local and global levels, and they will continue to be dispatched even if the first one returns a DisabledReason. It is opt-in, so we only use it for cases where we know that a local and a global handler share the same (default) keybinding.
Previously we would call pullFiles() from the pick() handler if we were not in a rebase, assuming that the default keybinding for both is "p". This needn't be the case of course, if the user has remapped one or the other. The consequence of this was that swapping the keybindings for "pullFiles" and "pushFiles" would work in all panels except the Commits panel (unless "pick" was also remapped in the same way). Fix this by using the new AllowFurtherDispatching mechanism of DisabledReasons to pass the keybinding on to the next handler.
4251ef6 to
c752f35
Compare
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | minor | `v0.51.1` -> `v0.52.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary> ### [`v0.52.0`](https://github.com/jesseduffield/lazygit/releases/tag/v0.52.0) [Compare Source](jesseduffield/lazygit@v0.51.1...v0.52.0) <!-- Release notes generated using configuration in .github/release.yml at v0.52.0 --> #### What's Changed ##### Enhancements 🔥 - Add user config for hiding the root item in the file tree by [@​stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4593 - Use branchPrefix when moving commits to new branch by [@​EliasA5](https://github.com/EliasA5) in jesseduffield/lazygit#4604 - Show default option when prompting to create a new git repo by [@​Joshuahuahua](https://github.com/Joshuahuahua) in jesseduffield/lazygit#4596 ##### Fixes 🔧 - Fix selecting large hunks, and fix problems editing very long commit descriptions by [@​stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4589 - Kill background fetch when it requests a passphrase by [@​stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4588 - Fix branch selection jumping back on background fetch by [@​stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4597 - Fix resetting to a branch when a tag shares the same name, or vice versa by [@​ChrisMcD1](https://github.com/ChrisMcD1) in jesseduffield/lazygit#4571 - Fix wrong inactive highlight when switching between repos by [@​stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4621 - Fix assigning custom key to pullFiles command in the Commits panel by [@​stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4617 ##### Maintenance ⚙️ - Replace literal with ConfigFilename constant by [@​mloskot](https://github.com/mloskot) in jesseduffield/lazygit#4613 - Improve MR template wrt release notes by [@​stefanhaller](https://github.com/stefanhaller) in jesseduffield/lazygit#4607 #### New Contributors - [@​mloskot](https://github.com/mloskot) made their first contribution in jesseduffield/lazygit#4613 - [@​Joshuahuahua](https://github.com/Joshuahuahua) made their first contribution in jesseduffield/lazygit#4596 **Full Changelog**: jesseduffield/lazygit@v0.51.1...v0.52.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC41MC4wIiwidXBkYXRlZEluVmVyIjoiNDAuNTAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Improve the dispatching of key bindings so that remapping "pullFiles" to a different key works correctly in the Commits panel.
Fixes #4614.
go generate ./...)