aboutsummaryrefslogtreecommitdiff
path: root/internal/color
diff options
context:
space:
mode:
Diffstat (limited to 'internal/color')
-rw-r--r--internal/color/color.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/color/color.go b/internal/color/color.go
index 58c040c..dcbb280 100644
--- a/internal/color/color.go
+++ b/internal/color/color.go
@@ -6,6 +6,7 @@ import (
"regexp"
"strconv"
"strings"
+ "unicode/utf8"
)
const Reset = "\033[0m"
@@ -176,7 +177,7 @@ func StyleCode(name string) string {
}
func VisibleLen(s string) int {
- return len(ansiRe.ReplaceAllString(s, ""))
+ return utf8.RuneCountInString(ansiRe.ReplaceAllString(s, ""))
}
func ContrastFg(mode string, bgIndex int) string {