Skip to content
Myr

Fix alt-, for --expect

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 408c04f · Browse files · 2 files+6 added−0 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+6 added−0 removed

  • other:+6 added−0 removed

2 files+6 added−0 removed

modified:src/options_test.go+4 added
223 unmodified lines
224225 pairs = parseKeyChords(",,,", "")226 checkN(len(pairs), 1)227 check(pairs, tui.Key(','), ",")228229 pairs = parseKeyChords(",ALT-,,", "")230 checkN(len(pairs), 1)231 check(pairs, tui.AltKey(','), "ALT-,")232}233234func TestBind(t *testing.T) {235 keymap := defaultKeymap()
222 unmodified lines
modified:src/options.go+2 added
447 unmodified lines
448 if len(str) == 0 {449 errorExit(message)450 }451452 str = regexp.MustCompile("(?i)(alt-),").ReplaceAllString(str, "$1"+string(escapedComma))453 tokens := strings.Split(str, ",")454 if str == "," || strings.HasPrefix(str, ",,") || strings.HasSuffix(str, ",,") || strings.Contains(str, ",,,") {455 tokens = append(tokens, ",")456 }
2 unmodified lines
459 for _, key := range tokens {460 if len(key) == 0 {461 continue // ignore462 }463 key = strings.ReplaceAll(key, string(escapedComma), ",")464 lkey := strings.ToLower(key)465 add := func(e tui.EventType) {466 chords[e.AsEvent()] = key467 }
1120 unmodified lines