Skip to content

Conversation

@stefanhaller
Copy link
Collaborator

@stefanhaller stefanhaller commented Dec 21, 2025

Previously they would be shown as keybindings in the menu, but they didn't work because their builtin functionality (select next/prev line, scroll view left/right) would take precedence.

This will allow us to revert #4934; doing that in a separate PR, see #5132.

@stefanhaller stefanhaller added the bug Something isn't working label Dec 21, 2025
@codacy-production
Copy link

codacy-production bot commented Dec 21, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for b7a24c81 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b7a24c8) Report Missing Report Missing Report Missing
Head commit (344d386) 59289 51583 87.00%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#5131) 86 86 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

return handle(self.c.Git().WorkingTree.StageFile, self.c.Tr.Actions.ResolveConflictByKeepingFile)
},
Key: 'p',
Key: 'k',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is changing keys for actions not considered a breaking change? Either way maybe we could consider changing it in another PR to keep this one to the point?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this in the commit message; I don't think the muscle memory issue is a concern here because it's not a frequently encountered dialog.

Moving it to a separate PR sounds good though, see #5132.

Comment on lines +49 to +71
t.Views().Files().
Focus().
IsEmpty().
Press("x").
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("My Custom Commands")).
Lines(
Contains("j echo j"),
Contains("H echo H"),
Contains(" echo y"),
Contains(" echo down"),
)
t.GlobalPress("j")
t.ExpectPopup().Alert().Title(Equals("echo j")).Content(Equals("j")).Confirm()
}).
Press("x").
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("My Custom Commands"))
t.GlobalPress("H")
t.ExpectPopup().Alert().Title(Equals("echo H")).Content(Equals("H")).Confirm()
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a negative test. For example by checking that pressing y and/or <down> does not trigger their respective options.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did think about that, but decided it's not necessary to complicate the test with that. Knowing how our menus work, it's enough to verify that the keybindings don't show up in the UI, we can then be sure they also don't trigger.

The test shows two problems: a <down> keybinding is not removed from a menu item
(the 'y' binding is removed though, which is correct), and keybindings such as
'j' and 'H' don't work. We will fix both of these separately in the following
commits.
This is not really super important because we are very unlikely to assign a key
such as esc or up/down to a menu item. However, users might do this in a custom
commands menu, and in that case it is important that the builtin keys still
work; or they might remap those builtin commands to other keys, in which case
they might conflict with single-letter keys in normal menus.
After the change in the previous commit this expresses better what it is about.
…onfirm/esc

This makes it possible to use 'j', 'k', 'H' or 'L' as menu item keybindings.
stefanhaller added a commit that referenced this pull request Dec 22, 2025
Now that we can use 'k' as a menu item binding (this was fixed in #5131), use it
for the "keep" entry in the merge menu. I don't think this will be a problem for
people's muscle memory, given that this menu is not encountered every day; and
it's simply the better keybinding.

This reverts commit b32b552.
@stefanhaller stefanhaller merged commit 70fe7bd into master Dec 22, 2025
13 checks passed
@stefanhaller stefanhaller deleted the fix-menu-keybindings branch December 22, 2025 08:48
stefanhaller added a commit that referenced this pull request Dec 22, 2025
Now that we can use 'k' as a menu item binding (this was fixed in #5131), use it
for the "keep" entry in the merge menu. I don't think this will be a problem for
people's muscle memory, given that this menu is not encountered every day; and
it's simply the better keybinding.

This reverts commit b32b552.
stefanhaller added a commit that referenced this pull request Dec 22, 2025
…5132)

Now that we can use 'k' as a menu item binding (this was fixed in
#5131), use it for the "keep" entry in the merge menu. I don't think
this will be a problem for people's muscle memory, given that this menu
is not encountered every day; and it's simply the better keybinding.

This reverts commit b32b552.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants