micro-editor / micro-editor/micro

Unbinding a key doesn't work in some cases

Open
#1,651 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

Description of the problem or steps to reproduce

For example, after running the following commands:
bind "Ctrl-D" "FindNext"
unbind "Ctrl-D"
Ctrl-D still triggers FindNext instead of its default action DuplicateLine.

The reason is that in DefaultBindings() in defaults_other.go it is specified as "CtrlD", not "Ctrl-D".

In other words, there is no 1-to-1 correspondence between events and their name strings. E.g. "CtrlD", "Ctrl-D" and "Ctrl-d" are all the same event.
So in bindings.go we should search bindings not by event name strings (as we do now, using DefaultBindings() and config.Bindings) but rather by Event structures.

Specifications

Commit hash: 55e9759
OS: Debian 9.12
Terminal: xfce4-terminal, xterm

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading bindings.go and DefaultBindings() in defaults_other.go, then trace how unbind resolves event names. Check how equivalent names such as "CtrlD", "Ctrl-D", and "Ctrl-d" are represented by Event structures. Done means unbinding a key removes the binding regardless of which equivalent name was used, preserving the default action.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.