m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 08:13:40 -05:00

Use fixed-length array when possible (#4488)

This commit is contained in:
Ioannis Pinakoulakis
2025-08-15 15:16:41 +03:00
committed by GitHub
parent 978b6254c7
commit 49967f3d45

View File

@@ -128,9 +128,9 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
// No ANSI codes // No ANSI codes
if len(itemColors) == 0 && len(nthOffsets) == 0 { if len(itemColors) == 0 && len(nthOffsets) == 0 {
var offsets []colorOffset offsets := make([]colorOffset, len(matchOffsets))
for _, off := range matchOffsets { for i, off := range matchOffsets {
offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true}) offsets[i] = colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true}
} }
return offsets return offsets
} }