m/fzf
1
0
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:
Junegunn Choi
2017-07-16 23:31:19 +09:00
parent 4b59ced08f
commit 9e85cba0d0
12 changed files with 139 additions and 122 deletions

View File

@@ -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}
})
}