Fix parse error of --bind expression
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent c03c058 · Browse files · 2 files·+10 added−6 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+10 added−6 removed
- other:+10 added−6 removed
Provenance
- Commit
60465c4- Tree
9a27be8- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
c03c058
2 files changed+10 added−6 removed
modified:src/options_test.go+2 added-2 removed
241 unmodified lines242 }243 check(tui.CtrlA, "", actBeginningOfLine)244 parseKeymap(keymap,245 "ctrl-a:kill-line,ctrl-b:toggle-sort+up+down,c:page-up,alt-z:page-down,"+246- "f1:execute(ls {})+abort,f2:execute/echo {}, {}, {}/,f3:execute[echo '({})'],f4:execute;less {};,"+246+ "f1:execute(ls {+})+abort+execute(echo {+})+select-all,f2:execute/echo {}, {}, {}/,f3:execute[echo '({})'],f4:execute;less {};,"+247 "alt-a:execute-Multi@echo (,),[,],/,:,;,%,{}@,alt-b:execute;echo (,),[,],/,:,@,%,{};,"+248 "x:Execute(foo+bar),X:execute/bar+baz/"+249 ",,:abort,::accept,+:execute:++\nfoobar,Y:execute(baz)+up")250 check(tui.CtrlA, "", actKillLine)1 unmodified line252 check(tui.AltZ+'c', "", actPageUp)253 check(tui.AltZ+',', "", actAbort)254 check(tui.AltZ+':', "", actAccept)255 check(tui.AltZ, "", actPageDown)256- check(tui.F1, "ls {}", actExecute, actAbort)256+ check(tui.F1, "ls {+}", actExecute, actAbort, actExecute)257 check(tui.F2, "echo {}, {}, {}", actExecute)258 check(tui.F3, "echo '({})'", actExecute)259 check(tui.F4, "less {}", actExecute)260 check(tui.AltZ+'x', "foo+bar", actExecute)163 unmodified linesmodified:src/options.go+8 added-4 removed
646 unmodified lines647 func init() {648 // Backreferences are not supported.649 // "~!@#$%^&*;/|".each_char.map { |c| Regexp.escape(c) }.map { |c| "#{c}[^#{c}]*#{c}" }.join('|')650 executeRegexp = regexp.MustCompile(651- `(?si):(execute(?:-multi|-silent)?|reload):.+|:(execute(?:-multi|-silent)?|reload)(\([^)]*\)|\[[^\]]*\]|~[^~]*~|![^!]*!|@[^@]*@|\#[^\#]*\#|\$[^\$]*\$|%[^%]*%|\^[^\^]*\^|&[^&]*&|\*[^\*]*\*|;[^;]*;|/[^/]*/|\|[^\|]*\|)`)651+ `(?si)[:+](execute(?:-multi|-silent)?|reload):.+|[:+](execute(?:-multi|-silent)?|reload)(\([^)]*\)|\[[^\]]*\]|~[^~]*~|![^!]*!|@[^@]*@|\#[^\#]*\#|\$[^\$]*\$|%[^%]*%|\^[^\^]*\^|&[^&]*&|\*[^\*]*\*|;[^;]*;|/[^/]*/|\|[^\|]*\|)`)652 }653 654 func parseKeymap(keymap map[int][]action, str string) {655 masked := executeRegexp.ReplaceAllStringFunc(str, func(src string) string {656- prefix := ":execute"657- if strings.HasPrefix(src, ":reload") {658- prefix = ":reload"656+ symbol := ":"657+ if strings.HasPrefix(src, "+") {658+ symbol = "+"659+ }660+ prefix := symbol + "execute"661+ if strings.HasPrefix(src[1:], "reload") {662+ prefix = symbol + "reload"663 } else if src[len(prefix)] == '-' {664 c := src[len(prefix)+1]665 if c == 's' || c == 'S' {666 prefix += "-silent"712 unmodified lines