run go modernizer

This commit is contained in:
Kovid Goyal 2026-04-16 19:12:31 +05:30
parent 9b406c21ff
commit c3d1665fa6
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 5 additions and 5 deletions

View file

@ -142,8 +142,8 @@ func bestWordMatch(queryToken string, words []wordToken, colText string) (score
// Compound token: try exact substring match in the column text
colLower := strings.ToLower(colText)
if idx := strings.Index(colLower, queryToken); idx != -1 {
runeIdx := len([]rune(colLower[:idx]))
if before, _, ok := strings.Cut(colLower, queryToken); ok {
runeIdx := len([]rune(before))
qRuneLen := len([]rune(queryToken))
subParts := strings.FieldsFunc(queryToken, isWordDelimiter)
return 4 * len(subParts), runeRange(runeIdx, runeIdx+qRuneLen)

View file

@ -23,8 +23,8 @@ func testBinding(key, action, help string) Binding {
// Action. Action is derived as the first word of actionDisplay.
func testMouseBinding(key, actionDisplay string) Binding {
action := actionDisplay
if idx := strings.IndexByte(actionDisplay, ' '); idx >= 0 {
action = actionDisplay[:idx]
if before, _, ok := strings.Cut(actionDisplay, " "); ok {
action = before
}
return Binding{
Key: key,

View file

@ -245,7 +245,7 @@ func TestWatchForConfigChangesDebounce(t *testing.T) {
// Write to the file several times rapidly within the debounce window.
// The fswatcher debouncer drops events that occur within the cooldown period
// after the first event, so only the first write should produce an action call.
for i := 0; i < 5; i++ {
for i := range 5 {
write_file(t, main_conf, fmt.Sprintf("font_size %d\n", 12+i))
time.Sleep(20 * time.Millisecond)
}