forked from mirror/readline
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.
This commit is contained in:
parent
f6d7a1f6fb
commit
2972be24d4
|
@ -221,7 +221,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)-len(same)))
|
buf.Write(bytes.Repeat([]byte(" "), colWidth-runes.WidthAll(c)-runes.WidthAll(same)))
|
||||||
|
|
||||||
if inSelect {
|
if inSelect {
|
||||||
buf.WriteString("\033[0m")
|
buf.WriteString("\033[0m")
|
||||||
|
|
Loading…
Reference in New Issue