mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-09 00:22:02 -07:00
Fix inconsistent tiebreak scores when --nth is used
Make sure to consistently calculate tiebreak scores based on the original line. This change may not be preferable if you filter aligned tabular input on a subset of columns using --nth. However, if we calculate length tiebreak only on the matched components instead of the entire line, the result can be very confusing when multiple --nth components are specified, so let's keep it simple and consistent. Close #926
This commit is contained in:
14
src/core.go
14
src/core.go
@@ -95,9 +95,10 @@ func Run(opts *Options) {
|
||||
}
|
||||
chars, colors := ansiProcessor(data)
|
||||
return &Item{
|
||||
index: int32(index),
|
||||
text: chars,
|
||||
colors: colors}
|
||||
index: int32(index),
|
||||
trimLength: -1,
|
||||
text: chars,
|
||||
colors: colors}
|
||||
})
|
||||
} else {
|
||||
chunkList = NewChunkList(func(data []byte, index int) *Item {
|
||||
@@ -110,9 +111,10 @@ func Run(opts *Options) {
|
||||
}
|
||||
textRunes := joinTokens(trans)
|
||||
item := Item{
|
||||
index: int32(index),
|
||||
origText: &data,
|
||||
colors: nil}
|
||||
index: int32(index),
|
||||
trimLength: -1,
|
||||
origText: &data,
|
||||
colors: nil}
|
||||
|
||||
trimmed, colors := ansiProcessorRunes(textRunes)
|
||||
item.text = trimmed
|
||||
|
Reference in New Issue
Block a user