summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-07-18 02:31:35 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-07-18 02:31:35 +0900
commitc9abe1b1ff6e7ebbad9044941a0d7ea70b16802d (patch)
tree3de8a19fca5b1633c8bab5912e5d2f2bc85a5148
parenta0e6147bb57f5a4ba4b9c78a4e2d14989376c1fe (diff)
downloadfzf-c9abe1b1ff6e7ebbad9044941a0d7ea70b16802d.tar.gz
Show more specific error message on invalid binding
-rw-r--r--src/options.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/options.go b/src/options.go
index 1f535494..82dc6d97 100644
--- a/src/options.go
+++ b/src/options.go
@@ -453,12 +453,9 @@ func parseKeymap(keymap map[int]actionType, execmap map[int]string, toggleSort b
origPairStr := str[idx : idx+len(pairStr)]
idx += len(pairStr) + 1
- fail := func() {
- errorExit("invalid key binding: " + pairStr)
- }
pair := strings.SplitN(pairStr, ":", 2)
- if len(pair) != 2 {
- fail()
+ if len(pair) < 2 {
+ errorExit("bind action not specified: " + origPairStr)
}
var key int
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
} else {
keys := parseKeyChords(pair[0], "key name required")
- if len(keys) != 1 {
- fail()
- }
key = firstKey(keys)
}