Skip to content

Commit

Permalink
Modify the display width for Chinese characters and so on (chzyer#145)
Browse files Browse the repository at this point in the history
The display width will not be right if there have Chinese characters in the display. It will overflow the line, if the Chinese characters are at the end of a line. And makes "lines" value not the right number of line rows,  which makes "239: fmt.Fprintf" produce wrong output.
  • Loading branch information
Jim-wiselike authored and chzyer committed Jun 3, 2018
1 parent f6d7a1f commit 2972be2
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 @@ -221,7 +221,7 @@ func (o *opCompleter) CompleteRefresh() {
}
buf.WriteString(string(same))
buf.WriteString(string(c))
buf.Write(bytes.Repeat([]byte(" "), colWidth-len(c)-len(same)))
buf.Write(bytes.Repeat([]byte(" "), colWidth-runes.WidthAll(c)-runes.WidthAll(same)))

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

0 comments on commit 2972be2

Please sign in to comment.