Skip to content

Also support escape for dismissing commit error message #2552

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

Closed
Tillerino opened this issue Mar 7, 2025 · 4 comments · Fixed by #2563
Closed

Also support escape for dismissing commit error message #2552

Tillerino opened this issue Mar 7, 2025 · 4 comments · Fixed by #2563
Assignees
Labels

Comments

@Tillerino
Copy link

Is your feature request related to a problem? Please describe.
I love using pre-commit hooks and gitui nicely displays the output of the pre-commit hook when it fails:

Image

(the stacked dialogs... so beautiful 🤩)

To close this error, I now have to press enter. Escape does not work. The first couple of times, I actually quit gitui because I could not figure out how to close the dialog. Enter just does not compute for me, especially since gitui is pretty consistent with escape closing the current dialog.

I eventually figured out enter, but that breaks my brain every time. After pressing enter, I am now back in the commit dialog:

Image

I need to edit or stage stuff now, so I want to get rid of the commit dialog. What do I do? My monkey brain tells me: Close dialog again = repeat action = repeat key press. But I am in a text field. Pressing enter will just insert a line break. So for a couple of seconds, I just drool on my keyboard until eventually "close dialog = escape" echoes back to me from the future. Every time I feel like I was briefly unconscious.

Describe the solution you'd like
I want to close the commit error message dialog with escape. I think that would be consistent.

@extrawurst
Copy link
Collaborator

Good point. I cant recall why we used enter on these.. I am open for a PR to change that default but feel free to give it a try using the custom key bindings

@extrawurst extrawurst added the good first issue Good for newcomers label Mar 7, 2025
@Tillerino
Copy link
Author

Ah sorry, I didn't even know there are custom key bindings. Should have checked. But I can't find the binding for this one. I don't know what this is called, so I am just looking for enter. These are the ones I can see:

enter: GituiKeyEvent::new(KeyCode::Enter,  KeyModifiers::empty()),
select_tag: GituiKeyEvent::new(KeyCode::Enter,  KeyModifiers::empty()),
stage_unstage_item: GituiKeyEvent::new(KeyCode::Enter,  KeyModifiers::empty()),
newline: GituiKeyEvent::new(KeyCode::Enter,  KeyModifiers::empty()),

@wessamfathi
Copy link
Contributor

I'd like to work on this as my first issue. If no one's working on it, feel free to assign it to me!

@wessamfathi
Copy link
Contributor

Sent a pull request with a potential fix. This changes the default key to close the popup from Enter to Escape. If you want, I can modify it to close it with either, but I didn't feel that was the best behavior.

Let me know your feedback. I love gitui and this is my first pull request to an open-source project, so I'm doubly excited :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants