run go modernizer

This commit is contained in:
Kovid Goyal
2026-04-16 19:12:31 +05:30
parent 9b406c21ff
commit c3d1665fa6
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,