summaryrefslogtreecommitdiffstats
path: root/src/core.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-06-02 13:25:35 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-06-02 13:25:35 +0900
commit2e3dc75425d23b4d9e8e05a901395914cf8d3120 (patch)
treebaccbb0305c7337b95207945c55d5e33f726c55b /src/core.go
parent5d6eb5bfd64c6d5d773c71159d819b651dd5f7f1 (diff)
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
Diffstat (limited to 'src/core.go')
-rw-r--r--src/core.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core.go b/src/core.go
index 9b0109b0..2b91ab6e 100644
--- a/src/core.go
+++ b/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