lazygit
lazygit copied to clipboard
Square Brackets in Commit Messages not allowed
I'm using a tag like system with Square Brackets in Commit Messages. Lazygit won't allow me to type Square or Curly Brackets. Regular Brackets work fine. I already unset the Keybinds for the Square Brackets, but this didn't change the behavior.
Please fill out the Bug report template, I can type in [][][] in my commit message.
Not sure why i didn't get the template on creating the issue so, here goes:
Describe the bug When using "commit changes" i can not type Square or Curly Brackets. "commit changes using git editor" works fine.
To Reproduce
- Install lazygit on Windows 11
- Run lazygit in Terminal (new Windows terminal and old cmd tested)
- Stage any change
- Press "c" to commit
- Try typing
[ ]or{ }
Expected behavior Brackets can be typed as expected
Screenshots Not sure what to screenshot, since nothing is written into the Message Box
Version info: commit=16802a048e0425182f08cf0e9a2bc31480e9a55d, build date=2023-02-01T11:02:43Z, build source=binaryRelease, version=0.37.0, os=windows, arch=amd64, git version=2.40.0.windows.1
git version 2.40.0.windows.1
Debugging Results: Not a lot. When opening the commit window and typing, nothing is logged. One Error seems to be that lazygit is trying to merge to master in the background, which doesn't work for this repository, as the branch is called main and we don't have a master branch. I doubt that it has anything to do with this issue though. The Log:
Apr 25 14:28:30 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Apr 25 14:28:30 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe diff --submodule --no-ext-diff --unified=3 --color=always --cached -- environments/bfk_schulung/group_vars"
Apr 25 14:28:36 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium refs/heads/main --"
Apr 25 14:28:38 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe diff --submodule --no-ext-diff --unified=3 --color=always --cached -- environments/bfk_schulung/group_vars"
Apr 25 14:28:38 |ERRO| Unexpected error when running cmd task: exit status 1
Apr 25 14:28:40 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe diff --submodule --no-ext-diff --unified=3 --color=always --cached -- environments/bfk_schulung/group_vars/all.yml"
Apr 25 14:28:40 |DEBU| using cache for key status.showUntrackedFiles
Apr 25 14:28:40 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Apr 25 14:28:40 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe diff --submodule --no-ext-diff --unified=3 --color=always --cached -- environments/bfk_schulung/group_vars/all.yml"
Apr 25 14:28:41 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe diff --submodule --no-ext-diff --unified=3 --color=always --cached -- environments/bfk_schulung/group_vars"
Apr 25 14:28:50 |DEBU| using cache for key status.showUntrackedFiles
Apr 25 14:28:50 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Apr 25 14:28:50 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe diff --submodule --no-ext-diff --unified=3 --color=always --cached -- environments/bfk_schulung/group_vars"
Apr 25 14:28:51 |DEBU| RunCommand command="git fetch"
Apr 25 14:28:53 |INFO| refreshing the following scopes in async mode: branches,commits,remotes,tags
Apr 25 14:28:53 |DEBU| RunCommand command="git branch -r"
Apr 25 14:28:53 |DEBU| RunCommand command="git tag --list --sort=-creatordate"
Apr 25 14:28:53 |DEBU| RunCommand command="git merge-base \\\"HEAD\\\" \\\"HEAD\\\"@{u}"
Apr 25 14:28:53 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=\"%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)\" refs/heads"
Apr 25 14:28:53 |DEBU| RunCommand command="git symbolic-ref --short HEAD"
Apr 25 14:28:53 |DEBU| RunCommand command="git merge-base \\\"HEAD\\\" \\\"master\\\""
Apr 25 14:28:53 |ERRO| fatal: Not a valid object name master
command="git merge-base \\\"HEAD\\\" \\\"master\\\""
Apr 25 14:29:00 |DEBU| using cache for key status.showUntrackedFiles
Apr 25 14:29:00 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Apr 25 14:29:00 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe diff --submodule --no-ext-diff --unified=3 --color=always --cached -- environments/bfk_schulung/group_vars"
Apr 25 14:29:10 |DEBU| using cache for key status.showUntrackedFiles
Apr 25 14:29:10 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Apr 25 14:29:20 |DEBU| using cache for key status.showUntrackedFiles
Apr 25 14:29:20 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Apr 25 14:29:27 |DEBU| RunCommand command="C:\\Program Files\\Git\\cmd\\git.exe diff --submodule --no-ext-diff --unified=3 --color=always --cached -- environments/bfk_schulung/group_vars"
Are you using a US keyboard layout or some other?
That's interesting. I'm using the German Keyboard Layout. Switching my OS to English(US) i can type Brackets without issues. Not sure if it's important, but typing those brackets requires pressing Right Alt (Alt-Gr) plus Numbers 7 to 0
That's what I was aiming at, the combination of AltGr+key is what causes it, I'm guessing.
Thanks for reporting, at least you have a workaround until it's properly fixed! :)
I have this issue too, and it's quite a dealbreaker since we prefix all our commit messages with stuff like [FIX]. In my case, it's a french keyboard, and to get a '[', I normally need to press AltGr + 5
In editors.go, handleEditorKeypress() enters the following code:
// TODO: see if we need all three of these conditions: maybe the final one is sufficient
case ch != 0 && mod == 0 && unicode.IsPrint(ch):
textArea.TypeRune(ch)
ch == 91 (ASCII for '[' ) and mod == ModMotion|ModAlt.
Simply removing && mod == 0 fixes the issue.
(I can provide a PR if you prefer)
Happens to me as well, using the Spanish (International sort) keyboard layout. Cannot input square brackets despite working normally in other editors (Neovim) / programs
@Calvin1602 I'm happy to accept a PR with your proposed change
Hi Jesse, I don't know why but this is still not working on my machine. My keyboard layout is Spanish - International Sort (Windows 10), the keystroke for the [ ] symbols (as you can see, input is allowed as I am able to type these in here) is AltGr + the two keys to the right of "P", in the spain standard keyboard:
![]()
It may be an edge case.