Skip to content

Commit

Permalink
Fix column padding calculation to prevent wrapping (chzyer#83)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bbrowning authored and chzyer committed Sep 29, 2016
1 parent 283f542 commit bc5e387
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (o *opCompleter) CompleteRefresh() {
}
buf.WriteString(string(same))
buf.WriteString(string(c))
buf.Write(bytes.Repeat([]byte(" "), colWidth-len(c)))
buf.Write(bytes.Repeat([]byte(" "), colWidth-len(c)-len(same)))

if inSelect {
buf.WriteString("\033[0m")
Expand Down

0 comments on commit bc5e387

Please sign in to comment.