Skip to content

Commit 50bb2d7

Browse files
committed
refactor(input): test the composed chords with slices.ContainsFunc
go fix suggested it. isConfiguredKey returns the same answer and still stops at the first chord that matches. go fix also rewrote two copy-mode loops in copymode_visual.go with slices.Backward. I left them out: lastPrintedCell then grows past the inlining budget and the text grows by 283 bytes.
1 parent 45c368e commit 50bb2d7

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎internal/input/handler.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package input
55

66
import (
7+
"slices"
78
"strings"
89
"time"
910

@@ -871,10 +872,8 @@ func isConfiguredKey(msg tea.KeyPressMsg, s *config.Settings, base rune, is func
871872
if base == 0 {
872873
base = msg.BaseCode
873874
}
874-
for _, chord := range composedChords(msg, base) {
875-
if is(chord) {
876-
return optionGlyphsApply(msg, s.KeyboardLayout, s.OptionGlyphs)
877-
}
875+
if slices.ContainsFunc(composedChords(msg, base), is) {
876+
return optionGlyphsApply(msg, s.KeyboardLayout, s.OptionGlyphs)
878877
}
879878
return false
880879
}

0 commit comments

Comments
 (0)