mirror of
https://github.com/junegunn/fzf.git
synced 2026-03-27 11:03:36 +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:
@@ -869,7 +869,7 @@ func nthTransformer(str string) (func(Delimiter) func([]Token, int32) string, er
|
||||
nth []Range
|
||||
}
|
||||
|
||||
parts := make([]NthParts, len(indexes))
|
||||
parts := make([]NthParts, 0, len(indexes))
|
||||
idx := 0
|
||||
for _, index := range indexes {
|
||||
if idx < index[0] {
|
||||
|
||||
Reference in New Issue
Block a user