Add --tabstop option

Related: https://github.com/junegunn/fzf.vim/issues/49
This commit is contained in:
Junegunn Choi
2015-11-30 17:35:03 +09:00
parent 7bcf4effa5
commit 99ea1056ac
4 changed files with 39 additions and 1 deletions

View File

@@ -80,6 +80,7 @@ func (a byTimeOrder) Less(i, j int) bool {
var _spinner = []string{`-`, `\`, `|`, `/`, `-`, `\`, `|`, `/`}
var _runeWidths = make(map[rune]int)
var _tabStop int
const (
reqPrompt util.EventType = iota
@@ -194,6 +195,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
} else {
header = reverseStringArray(opts.Header)
}
_tabStop = opts.Tabstop
return &Terminal{
inlineInfo: opts.InlineInfo,
prompt: opts.Prompt,
@@ -324,7 +326,7 @@ func (t *Terminal) sortSelected() []selectedItem {
func runeWidth(r rune, prefixWidth int) int {
if r == '\t' {
return 8 - prefixWidth%8
return _tabStop - prefixWidth%_tabStop
} else if w, found := _runeWidths[r]; found {
return w
} else {