-
Notifications
You must be signed in to change notification settings - Fork 1.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
Crash when attempting to bind two key sequences C-x C-c Quit and C-x C-s Save #3194
Comments
I confirm it leads to crash on current master c64add2 with
Manually setting values int the |
Out of curiosity I tried to see if this was a regression and it seems like it maybe has always been this way, 2.0.7 was the first version that seemed to support this syntax and it crashes similarly. |
By adding small print in the code before error, I understood why it reports uncomparable types function micro/internal/action/bindings.go Lines 111 to 136 in c64add2
micro/internal/action/bindings.go Line 138 in c64add2
But I am curios why does type system doesn't report it as a problem? I micro/internal/action/bindings.go Lines 237 to 252 in c64add2
|
Interesting, before the comparison they should...at least from my understanding...type checked and in case of |
You iterate through all the bindings in the |
Or maybe I am wrong. I am almost always wrong |
https://go.dev/ref/spec#Comparison_operators
So comparing |
Description of the problem or steps to reproduce
I've used an editor for many, many years called microEmacs and I'm binding a few common keys I am used to use there into Micro to make it a little easier to transition to it. I was able to bind Control-x Control-s to Save just fine,
bind <Ctrl-x><Ctrl-s> "Save"
And it works. But I was trying to bind Control-X Control-c to quit and Micro crashes as soon as I hit enter.
bind <Ctrl-x><Ctrl-c> "Quit"
Micro encountered an error: runtime.errorString runtime error: comparing uncomparable type action.KeySequenceEvent
/usr/lib/golang/src/runtime/alg.go:266 (0x55e57f146d1a)
ifaceeq: if eq == nil {
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/action/bindings.go:269 (0x55e57f603514)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/action/command.go:663 (0x55e57f60c8c6)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/action/command.go:983 (0x55e57f60f1e4)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/action/actions.go:1470 (0x55e57f5ff892)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/info/infobuffer.go:147 (0x55e57f5d258e)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/action/infopane.go:190 (0x55e57f61310c)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/action/infopane.go:54 (0x55e57f61255d)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/action/infopane.go:125 (0x55e57f612a59)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/internal/action/infopane.go:93 (0x55e57f6127d0)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/cmd/micro/micro.go:443 (0x55e57f642c1c)
/builddir/build/BUILD/micro-2.0.11/_build/src/github.com/zyedidia/micro/cmd/micro/micro.go:382 (0x55e57f64268a)
/usr/lib/golang/src/runtime/internal/atomic/types.go:194 (0x55e57f17bf72)
(*Uint32).Load: return Load(&u.value)
/usr/lib/golang/src/runtime/asm_amd64.s:1598 (0x55e57f1ac481)
goexit: DATA shifts<>+0x00(SB)/8, $0x0000000000000000
After experimenting some more, it appears that I can't bind this sort of thing twice, unrelated to the command or control characters. If I remove the bindings.json I can bind whatever, but if I set one, then set another one, it crashes every time. If I remove bindings.json I can create Ctrl-x Ctrl-c and set it to Quit, works, but now I can't create Ctrl-x Ctrl-s for Save.
bindings.json after I've created a "Quit" command:
{
"\u003cCtrl-x\u003e\u003cCtrl-c\u003e": "Quit",
"Alt-/": "lua:comment.comment",
"CtrlUnderscore": "lua:comment.comment"
}
If I manually make a binding.json of the following, these two bindings do function in the editor:
{
"\u003cCtrl-x\u003e\u003cCtrl-c\u003e": "Quit",
"\u003cCtrl-x\u003e\u003cCtrl-s\u003e": "Save",
}
Basic reproduction steps:
Specifications
Commit hash: 225927b
OS: Fedora 38
Terminal: xfce-terminal
I have also tried on the latest Release version from the github, 68d88b5
Sorry for the weird formatting, github markdown (?) was eating some of the sequences.
The text was updated successfully, but these errors were encountered: