diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2018-06-14 19:27:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-14 19:27:21 +0200 |
commit | c8b99b97dffbc7c96b3911f6301f0ec69399cea2 (patch) | |
tree | ec8fd6b1b8b9dc09c516d17419bcb01287815dcd /vendor/github.com/mattn/go-runewidth/runewidth_windows.go | |
parent | 8883f487886f8ad6b1529372fa467aaa7aeed5ec (diff) | |
download | chat-c8b99b97dffbc7c96b3911f6301f0ec69399cea2.tar.gz chat-c8b99b97dffbc7c96b3911f6301f0ec69399cea2.tar.bz2 chat-c8b99b97dffbc7c96b3911f6301f0ec69399cea2.zip |
Update html2text lib to use the original repo (#8900)
Diffstat (limited to 'vendor/github.com/mattn/go-runewidth/runewidth_windows.go')
-rw-r--r-- | vendor/github.com/mattn/go-runewidth/runewidth_windows.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go new file mode 100644 index 000000000..0258876b9 --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go @@ -0,0 +1,25 @@ +package runewidth + +import ( + "syscall" +) + +var ( + kernel32 = syscall.NewLazyDLL("kernel32") + procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP") +) + +// IsEastAsian return true if the current locale is CJK +func IsEastAsian() bool { + r1, _, _ := procGetConsoleOutputCP.Call() + if r1 == 0 { + return false + } + + switch int(r1) { + case 932, 51932, 936, 949, 950: + return true + } + + return false +} |