forked from TrueCloudLab/rclone
ncdu: fix display corruption with Chinese characters - #2989
This commit is contained in:
parent
f1809451f6
commit
997654d77d
1 changed files with 2 additions and 1 deletions
|
@ -10,6 +10,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
runewidth "github.com/mattn/go-runewidth"
|
||||||
"github.com/ncw/rclone/cmd"
|
"github.com/ncw/rclone/cmd"
|
||||||
"github.com/ncw/rclone/cmd/ncdu/scan"
|
"github.com/ncw/rclone/cmd/ncdu/scan"
|
||||||
"github.com/ncw/rclone/fs"
|
"github.com/ncw/rclone/fs"
|
||||||
|
@ -122,7 +123,7 @@ func Printf(x, y int, fg, bg termbox.Attribute, format string, args ...interface
|
||||||
func Line(x, y, xmax int, fg, bg termbox.Attribute, spacer rune, msg string) {
|
func Line(x, y, xmax int, fg, bg termbox.Attribute, spacer rune, msg string) {
|
||||||
for _, c := range msg {
|
for _, c := range msg {
|
||||||
termbox.SetCell(x, y, c, fg, bg)
|
termbox.SetCell(x, y, c, fg, bg)
|
||||||
x++
|
x += runewidth.RuneWidth(c)
|
||||||
if x >= xmax {
|
if x >= xmax {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue