From 5f0123d1385dee849d25086d0397f07d92e44a68 Mon Sep 17 00:00:00 2001 From: Yongwen Zhuang Date: Tue, 14 May 2019 23:01:49 +0800 Subject: commands: ls fix CJK characters out of alignment #85 --- commands/ls.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'commands') diff --git a/commands/ls.go b/commands/ls.go index 22940f2f..94f0d0d6 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -7,6 +7,7 @@ import ( "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/util/colors" "github.com/MichaelMure/git-bug/util/interrupt" + "github.com/MichaelMure/git-bug/util/text" "github.com/spf13/cobra" ) @@ -65,8 +66,8 @@ func runLsBug(cmd *cobra.Command, args []string) error { } // truncate + pad if needed - titleFmt := fmt.Sprintf("%-50.50s", b.Title) - authorFmt := fmt.Sprintf("%-15.15s", name) + titleFmt := text.LeftPadMaxLine(b.Title, 50, 0) + authorFmt := text.LeftPadMaxLine(name, 15, 0) fmt.Printf("%s %s\t%s\t%s\tC:%d L:%d\n", colors.Cyan(b.HumanId()), -- cgit