-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Incorrect custom command configuration is handled poorly #4256
Comments
Thanks for the detailed report. I wonder if we should break it down a bit to make it easier to address:
|
Yeah, I was originally planning to write a fix myself after running into this issue but realized I'm probably not the right person to be mucking about with lazygit's code organization :D. So I filed this issue instead with the details. The breakdown of steps sounds like a good idea. |
Ah too bad. I was hoping you would come up with some bright ideas for those. 😄 Never mind, I'll see what I can do, but it doesn't have very high priority for me right now. |
The |
We have the |
Here's a PR that validates the key names (but not the context names yet): #4275. Testing and code reviews very welcome. |
- **PR Description** This improves the user experience when users try to use an invalid key name in their config, either for one of our standard keybindings or for the key of a custom command. Fixes half of #4256 (only the keybindings aspect of it, not the context names).
Describe the bug
I was trying to set up a custom command for the first time.
Putting that in my config and launching lazygit on Windows causes it to just immediately terminate with no error message and a strange artifact at the edge of the window.

Only later did I learn that ctrl-m was not supported: docs/keybindings/Custom_Keybindings.md
lazygit/pkg/gui/keybindings/keybindings.go
Line 110 in 0fd7b9b
log.Fatal while the TUI has already started appears to cause this issue. I tried different shells and terminals on Windows to the same result. On WSL, it's better but multiline log.Fatal's still do not render quite correctly

(This log.Fatal happens when providing an invalid custom command context)
I think the ideal behavior would be for the custom command key/context validation to happen in
lazygit/pkg/config/app_config.go
Line 207 in 853a04d
Custom command misconfigurations would then behave consistently with how other user config errors are (gracefully) handled:
Actually making that fix is a bit of a refactor though...
Also, I noticed there are 3 disagreeing sources for what is a valid context value.
lazygit/pkg/gui/services/custom_commands/keybinding_creator.go
Line 65 in 853a04d
context: 'statusSpacer1'
is accepted...)lazygit/pkg/gui/services/custom_commands/keybinding_creator.go
Line 87 in 853a04d
To Reproduce
Steps to reproduce the behavior:
Add
or
to your config and then launch lazygit
Expected behavior
See above
Screenshots
If applicable, add screenshots to help explain your problem.
Version info:
master branch
Additional context
Add any other context about the problem here.
Note: please try updating to the latest version or manually building the latest
master
to see if the issue still occurs.The text was updated successfully, but these errors were encountered: