Skip to content

Commit 2972be2

Browse files
Jim-wiselikechzyer
Jim-wiselike
authored andcommitted
Modify the display width for Chinese characters and so on (#145)
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.
1 parent f6d7a1f commit 2972be2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

complete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func (o *opCompleter) CompleteRefresh() {
221221
}
222222
buf.WriteString(string(same))
223223
buf.WriteString(string(c))
224-
buf.Write(bytes.Repeat([]byte(" "), colWidth-len(c)-len(same)))
224+
buf.Write(bytes.Repeat([]byte(" "), colWidth-runes.WidthAll(c)-runes.WidthAll(same)))
225225

226226
if inSelect {
227227
buf.WriteString("\033[0m")

0 commit comments

Comments
 (0)