소스 검색

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

xormplus 7 년 전
부모
커밋
4c9129baff
1개의 변경된 파일12개의 추가작업 그리고 1개의 파일을 삭제
  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