Nullify --nth option when it's irrelevant

This commit is contained in:
Junegunn Choi
2015-01-23 06:26:00 +09:00
parent 8bead4ae34
commit c35d98dc42
3 changed files with 62 additions and 11 deletions

View File

@@ -266,6 +266,17 @@ func parseOptions(opts *Options, allArgs []string) {
}
}
}
// If we're not using extended search mode, --nth option becomes irrelevant
// if it contains the whole range
if opts.Mode == ModeFuzzy || len(opts.Nth) == 1 {
for _, r := range opts.Nth {
if r.begin == rangeEllipsis && r.end == rangeEllipsis {
opts.Nth = make([]Range, 0)
return
}
}
}
}
// ParseOptions parses command-line options