Simplify Item structure

This commit compensates for the performance overhead from the
extended tiebreak option.
This commit is contained in:
Junegunn Choi
2016-01-13 21:36:44 +09:00
parent 1d2d32c847
commit 8d3a302a17
8 changed files with 43 additions and 58 deletions

View File

@@ -83,7 +83,6 @@ const (
byLength
byBegin
byEnd
byIndex
)
func defaultMargin() [4]string {
@@ -147,7 +146,7 @@ func defaultOptions() *Options {
Delimiter: Delimiter{},
Sort: 1000,
Tac: false,
Criteria: []criterion{byMatchLen, byLength, byIndex},
Criteria: []criterion{byMatchLen, byLength},
Multi: false,
Ansi: false,
Mouse: true,
@@ -382,7 +381,6 @@ func parseTiebreak(str string) []criterion {
switch str {
case "index":
check(&hasIndex, "index")
criteria = append(criteria, byIndex)
case "length":
check(&hasLength, "length")
criteria = append(criteria, byLength)
@@ -396,9 +394,6 @@ func parseTiebreak(str string) []criterion {
errorExit("invalid sort criterion: " + str)
}
}
if !hasIndex {
criteria = append(criteria, byIndex)
}
return criteria
}