Replace sort.Sort(ByOrder(...)) with slices.SortFunc
CodeQL / Analyze (go) (push) Has been cancelled
build / build (push) Has been cancelled
Test fzf on macOS / build (push) Has been cancelled

This commit is contained in:
Junegunn Choi
2026-04-12 10:43:47 +09:00
parent 1b0d448c6e
commit bd4a18d0a9
3 changed files with 22 additions and 20 deletions
+3 -2
View File
@@ -13,6 +13,7 @@ import (
"os/exec"
"os/signal"
"regexp"
"slices"
"sort"
"strconv"
"strings"
@@ -3751,7 +3752,7 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
offset := Offset{int32(p), int32(p + w)}
charOffsets[idx] = offset
}
sort.Sort(ByOrder(charOffsets))
slices.SortFunc(charOffsets, compareOffsets)
}
// When postTask is nil, we're printing header lines. No need to care about nth.
@@ -3788,7 +3789,7 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
end := start + int32(length)
nthOffsets[i] = Offset{int32(start), int32(end)}
}
sort.Sort(ByOrder(nthOffsets))
slices.SortFunc(nthOffsets, compareOffsets)
}
}
allOffsets := result.colorOffsets(charOffsets, nthOffsets, t.theme, colBase, colMatch, t.nthAttr, nthOverlay, hidden)