summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIoannis Pinakoulakis <ipinak@users.noreply.github.com>2025-08-15 15:16:41 +0300
committerGitHub <noreply@github.com>2025-08-15 21:16:41 +0900
commit49967f3d450d52934ec21c631cc9842446853bed (patch)
tree417b603a28913f4a7457d7465156099f3a29bfe9
parent978b6254c71a8b71d0ad0e58bee74c70a53c1345 (diff)
downloadfzf-49967f3d450d52934ec21c631cc9842446853bed.tar.gz
Use fixed-length array when possible (#4488)
-rw-r--r--src/result.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/result.go b/src/result.go
index 0ad0994e..36f56fb7 100644
--- a/src/result.go
+++ b/src/result.go
@@ -128,9 +128,9 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
// No ANSI codes
if len(itemColors) == 0 && len(nthOffsets) == 0 {
- var offsets []colorOffset
- for _, off := range matchOffsets {
- offsets = append(offsets, colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true})
+ offsets := make([]colorOffset, len(matchOffsets))
+ for i, off := range matchOffsets {
+ offsets[i] = colorOffset{offset: [2]int32{off[0], off[1]}, color: colMatch, match: true}
}
return offsets
}