diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 20:22:09 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 20:22:09 +0100 |
| commit | 5a8dbc6347b3541e84fe669b22c17ad3b715e258 (patch) | |
| tree | b148c450939688caaaeb4adac6f2faa1eaffe649 /vendor/github.com/mattn/go-runewidth/runewidth_windows.go | |
| download | qwe-editor-5a8dbc6347b3541e84fe669b22c17ad3b715e258.tar.gz | |
Engage!
Diffstat (limited to 'vendor/github.com/mattn/go-runewidth/runewidth_windows.go')
| -rw-r--r-- | vendor/github.com/mattn/go-runewidth/runewidth_windows.go | 28 |
1 files changed, 28 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 0000000..d6a6177 --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | // +build windows | ||
| 2 | // +build !appengine | ||
| 3 | |||
| 4 | package runewidth | ||
| 5 | |||
| 6 | import ( | ||
| 7 | "syscall" | ||
| 8 | ) | ||
| 9 | |||
| 10 | var ( | ||
| 11 | kernel32 = syscall.NewLazyDLL("kernel32") | ||
| 12 | procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP") | ||
| 13 | ) | ||
| 14 | |||
| 15 | // IsEastAsian return true if the current locale is CJK | ||
| 16 | func IsEastAsian() bool { | ||
| 17 | r1, _, _ := procGetConsoleOutputCP.Call() | ||
| 18 | if r1 == 0 { | ||
| 19 | return false | ||
| 20 | } | ||
| 21 | |||
| 22 | switch int(r1) { | ||
| 23 | case 932, 51932, 936, 949, 950: | ||
| 24 | return true | ||
| 25 | } | ||
| 26 | |||
| 27 | return false | ||
| 28 | } | ||
