Skip to content
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

Show the alt-enter keybinding at bottom of commit description view #4136

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

stefanhaller
Copy link
Collaborator

  • PR Description

It wasn't really obvious how to commit when the focus is in the commit description view, since pressing enter inserts a newline there. To improve this, show the <a-enter> keybinding at the bottom of the description view when it is focused.

Fixes #4134.

Copy link

codacy-production bot commented Jan 1, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for ebfc7ff1 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (ebfc7ff) Report Missing Report Missing Report Missing
Head commit (bf93395) 51615 44610 86.43%

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 (#4136) 12 12 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

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

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.

@jesseduffield
Copy link
Owner

A better solution would be the following:

diff --git a/pkg/gui/controllers/commit_description_controller.go b/pkg/gui/controllers/commit_description_controller.go
index 9f1fe78e5..0f5b84577 100644
--- a/pkg/gui/controllers/commit_description_controller.go
+++ b/pkg/gui/controllers/commit_description_controller.go
@@ -33,8 +33,10 @@ func (self *CommitDescriptionController) GetKeybindings(opts types.KeybindingsOp
 			Handler: self.close,
 		},
 		{
-			Key:     opts.GetKey(opts.Config.Universal.ConfirmInEditor),
-			Handler: self.confirm,
+			Key:             opts.GetKey(opts.Config.Universal.ConfirmInEditor),
+			Handler:         self.confirm,
+			DisplayOnScreen: true,
+			Description:     self.c.Tr.Confirm,
 		},
 		{
 			Key:     opts.GetKey(opts.Config.CommitMessage.CommitMenu),

@stefanhaller
Copy link
Collaborator Author

Hm, is that really better? I find the change of the bottom line quite hard to notice in this case. Also, if we do that than we should also move the existing ones (tab and <c-o>) down there too. (I'm not proposing we do that, I find those easier to see in the panel itself, too.)

BTW, and unrelated: the bottom line says Keybindings: ? when the commit message panel is open, which is wrong.

@stefanhaller
Copy link
Collaborator Author

Here's a PR that fixes that last point above: #4143.

Copy link
Owner

@jesseduffield jesseduffield left a comment

Choose a reason for hiding this comment

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

Fair enough, LGTM

@stefanhaller stefanhaller enabled auto-merge January 3, 2025 09:10
It was hard to discover, this should make it more obvious.
@stefanhaller stefanhaller force-pushed the make-alt-enter-to-commit-discoverable branch from 0bf42d9 to bf93395 Compare January 3, 2025 09:16
@stefanhaller stefanhaller merged commit ef718f3 into master Jan 3, 2025
15 checks passed
@stefanhaller stefanhaller deleted the make-alt-enter-to-commit-discoverable branch January 3, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UX for committing and tagging is non-obvious
2 participants