From 997654d77decc569deb89927686a5ac8aab20ed0 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 26 Feb 2019 19:18:52 +0000 Subject: [PATCH] ncdu: fix display corruption with Chinese characters - #2989 --- cmd/ncdu/ncdu.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/ncdu/ncdu.go b/cmd/ncdu/ncdu.go index 343647e41..6dd13cc50 100644 --- a/cmd/ncdu/ncdu.go +++ b/cmd/ncdu/ncdu.go @@ -10,6 +10,7 @@ import ( "sort" "strings" + runewidth "github.com/mattn/go-runewidth" "github.com/ncw/rclone/cmd" "github.com/ncw/rclone/cmd/ncdu/scan" "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) { for _, c := range msg { termbox.SetCell(x, y, c, fg, bg) - x++ + x += runewidth.RuneWidth(c) if x >= xmax { return }