Browse Source

Get latest revision "github.com/mattn/go-runewidth"

xormplus 7 years ago
parent
commit
4c9129baff
1 changed files with 12 additions and 1 deletions
  1. 12 1
      vendor/github.com/mattn/go-runewidth/runewidth.go

+ 12 - 1
vendor/github.com/mattn/go-runewidth/runewidth.go

@@ -1,13 +1,24 @@
 package runewidth
 
+import "os"
+
 var (
 	// EastAsianWidth will be set true if the current locale is CJK
-	EastAsianWidth = IsEastAsian()
+	EastAsianWidth bool
 
 	// DefaultCondition is a condition in current locale
 	DefaultCondition = &Condition{EastAsianWidth}
 )
 
+func init() {
+	env := os.Getenv("RUNEWIDTH_EASTASIAN")
+	if env == "" {
+		EastAsianWidth = IsEastAsian()
+	} else {
+		EastAsianWidth = env == "1"
+	}
+}
+
 type interval struct {
 	first rune
 	last  rune