mirror of
https://github.com/junegunn/fzf.git
synced 2026-08-13 03:11:08 +08:00
Fix nthTransformer parts slice preallocation (#4734)
Use make([]NthParts, 0, len(indexes)) so the slice starts empty with reserved capacity. The previous length-len(indexes) allocation left leading zero NthParts entries before appended elements.
This commit is contained in:
+1
-1
@@ -869,7 +869,7 @@ func nthTransformer(str string) (func(Delimiter) func([]Token, int32) string, er
|
|||||||
nth []Range
|
nth []Range
|
||||||
}
|
}
|
||||||
|
|
||||||
parts := make([]NthParts, len(indexes))
|
parts := make([]NthParts, 0, len(indexes))
|
||||||
idx := 0
|
idx := 0
|
||||||
for _, index := range indexes {
|
for _, index := range indexes {
|
||||||
if idx < index[0] {
|
if idx < index[0] {
|
||||||
|
|||||||
Reference in New Issue
Block a user