mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-02-03 04:28:36 +00:00
Fix parse error of actions with arguments
This commit is contained in:
parent
4b055bf260
commit
def011c029
@ -1131,7 +1131,7 @@ func parseKeymap(keymap map[tui.Event][]*action, str string, exit func(string))
|
|||||||
|
|
||||||
func isExecuteAction(str string) actionType {
|
func isExecuteAction(str string) actionType {
|
||||||
matches := executeRegexp.FindAllStringSubmatch(":"+str, -1)
|
matches := executeRegexp.FindAllStringSubmatch(":"+str, -1)
|
||||||
if matches == nil || len(matches) != 1 {
|
if matches == nil || len(matches) != 1 || len(matches[0][0]) != len(str)+1 {
|
||||||
return actIgnore
|
return actIgnore
|
||||||
}
|
}
|
||||||
prefix := matches[0][1]
|
prefix := matches[0][1]
|
||||||
|
@ -489,3 +489,13 @@ func TestParseSingleActionList(t *testing.T) {
|
|||||||
t.Errorf("Invalid action parsed: %v", actions[3])
|
t.Errorf("Invalid action parsed: %v", actions[3])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestParseSingleActionListError(t *testing.T) {
|
||||||
|
err := ""
|
||||||
|
parseSingleActionList("change-query(foobar)baz", func(e string) {
|
||||||
|
err = e
|
||||||
|
})
|
||||||
|
if len(err) == 0 {
|
||||||
|
t.Errorf("Failed to detect error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user