micro
micro copied to clipboard
Rebinding of default keys is not reflected in the Key Menu
Description of the problem or steps to reproduce
When rebinding default keys, the menu that shows with the ToggleKeyMenu
action doesn't reflect the changes.
Steps to reproduce:
- Change some default keybindings, e.g.:
{
"Alt-z": "Redo",
"Ctrl-y": "None",
"Alt-?": "ToggleHelp",
"Ctrl-g": "FindLiteral",
}
-
Launch
micro
. Observe that the bindings are in effect:Ctrl-y
does nothing, whileAlt-z
performs redo.Ctrl-g
starts a search, whileAlt-?
shows the help. -
Hit
Alt-g
to show the key menu. -
However, observe that the menu still shows
^Y Redo
and^G Help
, which do not correspond to the bindings currently in effect.
Specifications
Version: 2.0.13 Commit hash: 68d88b57 OS: ChromeOS Terminal: ChromeOS Terminal
It isn't a bug (in the sense of code), it is just a static and hard coded string internal/display/infowindow.go#L181.
You can even find several lines below comment with // TODO: maybe make this based on the actual keybindings
:)
The // TODO
can be seen as possible improvement.
Help is appreciated to do the necessary change, test it and provide it as a PR.
I suggest to turn the keydisplay
into a lookup map, where the user string (e.g. Save
, Cut Line
, etc) is the key and the respective builtin command the value. Then it can be compared against action.Binder["buffer"]
, where the actual key binding is stored. This then could be used as key to display in front of the above mentioned strings.
@semirke It looks like you started to do it in your fork https://github.com/semirke/micro/pull/1/commits/0fad40946fd02d76c6b3d1177a501e0eec01f136. Although it is buggy...
But would you work on it further? (and when will finish the feature to backport it as PR? ;)
@dustdfg There was already an old PR about it, I merged it in my repo.
Ok. I assume this https://github.com/zyedidia/micro/pull/2152. Although it won't just compile without adding one line to function that will complain about not defined keydisplay
func (i *InfoWindow) Display() {
+ keydisplay := keydisplayGen()
Ok. I assume this #2152. Although it won't just compile without adding one line to function that will complain about not defined keydisplay
func (i *InfoWindow) Display() { + keydisplay := keydisplayGen()
Yes, I had to fix it. Making that buffer pageable would be quite nice and adding all keys. I didnt have trouble with missing keys, so I didnt bump into your find.
@semirke It looks like you started to do it in your fork semirke@0fad409. Although it is buggy...
But would you work on it further? (and when will finish the feature to backport it as PR? ;)
Ok, I checked, the original PR was correct, something went wrong when I merged it. Fixed in my branch,too.