mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 15:23:48 -05:00
Reduce memory footprint of Item struct
This commit is contained in:
18
src/core.go
18
src/core.go
@@ -98,11 +98,8 @@ func Run(opts *Options, revision string) {
|
||||
return nilItem
|
||||
}
|
||||
chars, colors := ansiProcessor(data)
|
||||
return Item{
|
||||
index: int32(index),
|
||||
trimLength: -1,
|
||||
text: chars,
|
||||
colors: colors}
|
||||
chars.Index = int32(index)
|
||||
return Item{text: chars, colors: colors}
|
||||
})
|
||||
} else {
|
||||
chunkList = NewChunkList(func(data []byte, index int) Item {
|
||||
@@ -114,16 +111,9 @@ func Run(opts *Options, revision string) {
|
||||
return nilItem
|
||||
}
|
||||
textRunes := joinTokens(trans)
|
||||
item := Item{
|
||||
index: int32(index),
|
||||
trimLength: -1,
|
||||
origText: &data,
|
||||
colors: nil}
|
||||
|
||||
trimmed, colors := ansiProcessorRunes(textRunes)
|
||||
item.text = trimmed
|
||||
item.colors = colors
|
||||
return item
|
||||
trimmed.Index = int32(index)
|
||||
return Item{text: trimmed, colors: colors, origText: &data}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user