mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-18 23:07:13 +09:00
Fix unbind of a rune (#1649)
Fix problem with non-working unbind of a rune key. E.g. after the following commands: bind "n" "FindNext" unbind "n" Observed result: "n" key still triggers FindNext action Expected result: "n" key inserts "n" rune
This commit is contained in:
@@ -249,6 +249,7 @@ func UnbindKey(k string) error {
|
||||
if a, ok := defaults[k]; ok {
|
||||
BindKey(k, a)
|
||||
} else if _, ok := config.Bindings[k]; ok {
|
||||
BufUnmap(key)
|
||||
delete(config.Bindings, k)
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,17 @@ func BufMapMouse(k MouseEvent, action string) {
|
||||
}
|
||||
}
|
||||
|
||||
// BufUnmap unmaps a key or mouse event from any action
|
||||
func BufUnmap(k Event) {
|
||||
delete(BufKeyBindings, k)
|
||||
delete(BufKeyStrings, k)
|
||||
|
||||
switch e := k.(type) {
|
||||
case MouseEvent:
|
||||
delete(BufMouseBindings, e)
|
||||
}
|
||||
}
|
||||
|
||||
// The BufPane connects the buffer and the window
|
||||
// It provides a cursor (or multiple) and defines a set of actions
|
||||
// that can be taken on the buffer
|
||||
|
||||
Reference in New Issue
Block a user