Fix column padding calculation to prevent wrapping (#83)

The calculation to determine how many spaces to use when padding
columns wasn't taking into account the length of the 'same' portion of
the completions and was only using the length of the completion
itself. This frequently caused the printed completions to wrap, making
the completion list much harder to read.
This commit is contained in:
Ben Browning 2016-09-28 21:01:11 -04:00 committed by chzyer
parent 283f5429f7
commit bc5e387904
1 changed files with 1 additions and 1 deletions

View File

@ -219,7 +219,7 @@ func (o *opCompleter) CompleteRefresh() {
} }
buf.WriteString(string(same)) buf.WriteString(string(same))
buf.WriteString(string(c)) buf.WriteString(string(c))
buf.Write(bytes.Repeat([]byte(" "), colWidth-len(c))) buf.Write(bytes.Repeat([]byte(" "), colWidth-len(c)-len(same)))
if inSelect { if inSelect {
buf.WriteString("\033[0m") buf.WriteString("\033[0m")