replace /x/text package with mattn/go-runewidth

Mentioned in #35.
This commit is contained in:
Gokcehan committed 2016-11-14 01:35:34 +03:00
1 parent d19809e8b6
commit d67054a000
2 files changed
+5 -6

No files matched your search

+5 -5
View File
@@ -9,17 +9,17 @@ import (
"unicode"
"unicode/utf8"
"golang.org/x/text/width"
"github.com/mattn/go-runewidth"
)
func isRoot(name string) bool { return filepath.Dir(name) == name }
func runeWidth(r rune) int {
k := width.LookupRune(r).Kind()
if k == width.EastAsianFullwidth || k == width.EastAsianWide {
return 2
w := runewidth.RuneWidth(r)
if w == 0 || (w == 2 && runewidth.IsAmbiguousWidth(r)) {
w = 1
}
return 1
return w
}
func runeSliceWidth(rs []rune) int {