m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 15:23:48 -05:00

Fix lint warnings (#4586)

go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...
This commit is contained in:
phanium
2025-11-12 21:05:17 +08:00
committed by GitHub
parent b9f2bf64ff
commit 91fab3b3c2
13 changed files with 34 additions and 35 deletions

View File

@@ -3526,11 +3526,12 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
} else {
tokens = Transform(Tokenize(item.text.ToString(), t.delimiter), t.nthCurrent)
}
for _, token := range tokens {
nthOffsets = make([]Offset, len(tokens))
for i, token := range tokens {
start := token.prefixLength
length := token.text.Length() - token.text.TrailingWhitespaces()
end := start + int32(length)
nthOffsets = append(nthOffsets, Offset{int32(start), int32(end)})
nthOffsets[i] = Offset{int32(start), int32(end)}
}
sort.Sort(ByOrder(nthOffsets))
}
@@ -4902,7 +4903,7 @@ func (t *Terminal) buildPlusList(template string, forcePlus bool) (bool, [3][]*I
if asterisk {
cnt := t.merger.Length()
all = make([]*Item, cnt)
for i := 0; i < cnt; i++ {
for i := range cnt {
all[i] = t.merger.Get(i).item
}
}
@@ -7154,7 +7155,7 @@ func (t *Terminal) constrain() {
// May need to try again after adjusting the offset
t.offset = util.Constrain(t.offset, 0, count)
for tries := 0; tries < maxLines; tries++ {
for range maxLines {
numItems := maxLines
// How many items can be fit on screen including the current item?
if t.canSpanMultiLines() && t.merger.Length() > 0 {
@@ -7208,7 +7209,7 @@ func (t *Terminal) constrain() {
scrollOff := util.Min(maxLines/2, t.scrollOff)
newOffset := t.offset
// 2-phase adjustment to avoid infinite loop of alternating between moving up and down
for phase := 0; phase < 2; phase++ {
for phase := range 2 {
for {
prevOffset := newOffset
numItems := t.merger.Length()