mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-23 23:28:31 +00:00
Fix alt-, for --expect
This commit is contained in:
parent
408c04f25f
commit
7136cfc68b
@ -449,6 +449,7 @@ func parseKeyChords(str string, message string) map[tui.Event]string {
|
|||||||
errorExit(message)
|
errorExit(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str = regexp.MustCompile("(?i)(alt-),").ReplaceAllString(str, "$1"+string(escapedComma))
|
||||||
tokens := strings.Split(str, ",")
|
tokens := strings.Split(str, ",")
|
||||||
if str == "," || strings.HasPrefix(str, ",,") || strings.HasSuffix(str, ",,") || strings.Contains(str, ",,,") {
|
if str == "," || strings.HasPrefix(str, ",,") || strings.HasSuffix(str, ",,") || strings.Contains(str, ",,,") {
|
||||||
tokens = append(tokens, ",")
|
tokens = append(tokens, ",")
|
||||||
@ -459,6 +460,7 @@ func parseKeyChords(str string, message string) map[tui.Event]string {
|
|||||||
if len(key) == 0 {
|
if len(key) == 0 {
|
||||||
continue // ignore
|
continue // ignore
|
||||||
}
|
}
|
||||||
|
key = strings.ReplaceAll(key, string(escapedComma), ",")
|
||||||
lkey := strings.ToLower(key)
|
lkey := strings.ToLower(key)
|
||||||
add := func(e tui.EventType) {
|
add := func(e tui.EventType) {
|
||||||
chords[e.AsEvent()] = key
|
chords[e.AsEvent()] = key
|
||||||
|
@ -225,6 +225,10 @@ func TestParseKeysWithComma(t *testing.T) {
|
|||||||
pairs = parseKeyChords(",,,", "")
|
pairs = parseKeyChords(",,,", "")
|
||||||
checkN(len(pairs), 1)
|
checkN(len(pairs), 1)
|
||||||
check(pairs, tui.Key(','), ",")
|
check(pairs, tui.Key(','), ",")
|
||||||
|
|
||||||
|
pairs = parseKeyChords(",ALT-,,", "")
|
||||||
|
checkN(len(pairs), 1)
|
||||||
|
check(pairs, tui.AltKey(','), "ALT-,")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBind(t *testing.T) {
|
func TestBind(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user