summaryrefslogtreecommitdiff
path: root/src/options.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-05-19 01:46:22 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-05-19 01:46:22 +0900
commit7ed9f8366235a70ce03cf3ab05fcfb6dbcfd9a10 (patch)
tree9f810a4997b492b404bc1384f75b60365b1d3126 /src/options.go
parentf498a9b3fb9d9a78c6c9866ffc0e296c21b3d7b4 (diff)
downloadfzf-7ed9f8366235a70ce03cf3ab05fcfb6dbcfd9a10.tar.gz
Validate jump label characters
Also extend default jump labels
Diffstat (limited to 'src/options.go')
-rw-r--r--src/options.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/options.go b/src/options.go
index 10a22287..ffd57e96 100644
--- a/src/options.go
+++ b/src/options.go
@@ -724,6 +724,7 @@ func parseOptions(opts *Options, allArgs []string) {
opts.History.maxSize = historyMax
}
}
+ validateJumpLabels := false
for i := 0; i < len(allArgs); i++ {
arg := allArgs[i]
switch arg {
@@ -817,6 +818,7 @@ func parseOptions(opts *Options, allArgs []string) {
opts.InlineInfo = false
case "--jump-labels":
opts.JumpLabels = nextString(allArgs, &i, "label characters required")
+ validateJumpLabels = true
case "-1", "--select-1":
opts.Select1 = true
case "+1", "--no-select-1":
@@ -927,6 +929,14 @@ func parseOptions(opts *Options, allArgs []string) {
if len(opts.JumpLabels) == 0 {
errorExit("empty jump labels")
}
+
+ if validateJumpLabels {
+ for _, r := range opts.JumpLabels {
+ if r < 32 || r > 126 {
+ errorExit("non-ascii jump labels are not allowed")
+ }
+ }
+ }
}
func postProcessOptions(opts *Options) {