Skip to content
Myr

Validate jump label characters

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Also extend default jump labels

authored by Junegunn Choi · committed by Junegunn Choi · parent f498a9b · Browse files · 2 files+11 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+11 added−1 removed

  • other:+11 added−1 removed

2 files+11 added−1 removed

modified:src/constants.go+1 added-1 removed
36 unmodified lines
37 // History38 defaultHistoryMax int = 10003940 // Jump labels41 defaultJumpLabels string = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM,<.>/?!@#$%^&*<>/?()[{]}"41 defaultJumpLabels string = "asdfghjklqwertyuiopzxcvbnm1234567890ASDFGHJKLQWERTYUIOPZXCVBNM`~;:,<.>/?'\"!@#$%^&*()[{]}-_=+"42)4344// fzf events45const (
15 unmodified lines
modified:src/options.go+10 added
722 unmodified lines
723 if opts.History != nil {724 opts.History.maxSize = historyMax725 }726 }727 validateJumpLabels := false728 for i := 0; i < len(allArgs); i++ {729 arg := allArgs[i]730 switch arg {731 case "-h", "--help":
85 unmodified lines
817 case "--no-inline-info":818 opts.InlineInfo = false819 case "--jump-labels":820 opts.JumpLabels = nextString(allArgs, &i, "label characters required")821 validateJumpLabels = true822 case "-1", "--select-1":823 opts.Select1 = true824 case "+1", "--no-select-1":825 opts.Select1 = false
102 unmodified lines
928929 if len(opts.JumpLabels) == 0 {930 errorExit("empty jump labels")931 }932933 if validateJumpLabels {934 for _, r := range opts.JumpLabels {935 if r < 32 || r > 126 {936 errorExit("non-ascii jump labels are not allowed")937 }938 }939 }940}941942func postProcessOptions(opts *Options) {943 // Default actions for CTRL-N / CTRL-P when --history is set
47 unmodified lines