mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-25 22:27:41 +00:00
Show more specific error message on invalid binding
This commit is contained in:
parent
a0e6147bb5
commit
c9abe1b1ff
@ -453,12 +453,9 @@ func parseKeymap(keymap map[int]actionType, execmap map[int]string, toggleSort b
|
|||||||
origPairStr := str[idx : idx+len(pairStr)]
|
origPairStr := str[idx : idx+len(pairStr)]
|
||||||
idx += len(pairStr) + 1
|
idx += len(pairStr) + 1
|
||||||
|
|
||||||
fail := func() {
|
|
||||||
errorExit("invalid key binding: " + pairStr)
|
|
||||||
}
|
|
||||||
pair := strings.SplitN(pairStr, ":", 2)
|
pair := strings.SplitN(pairStr, ":", 2)
|
||||||
if len(pair) != 2 {
|
if len(pair) < 2 {
|
||||||
fail()
|
errorExit("bind action not specified: " + origPairStr)
|
||||||
}
|
}
|
||||||
var key int
|
var key int
|
||||||
if len(pair[0]) == 1 && pair[0][0] == escapedColon {
|
if len(pair[0]) == 1 && pair[0][0] == escapedColon {
|
||||||
@ -467,9 +464,6 @@ func parseKeymap(keymap map[int]actionType, execmap map[int]string, toggleSort b
|
|||||||
key = ',' + curses.AltZ
|
key = ',' + curses.AltZ
|
||||||
} else {
|
} else {
|
||||||
keys := parseKeyChords(pair[0], "key name required")
|
keys := parseKeyChords(pair[0], "key name required")
|
||||||
if len(keys) != 1 {
|
|
||||||
fail()
|
|
||||||
}
|
|
||||||
key = firstKey(keys)
|
key = firstKey(keys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user