mirror of
https://github.com/VladimirMarkelov/clui.git
synced 2025-05-05 19:30:22 +08:00
Merge pull request #75 from linkerlin/patch-1
Added support for Chinese
This commit is contained in:
commit
fb6ab7b916
@ -4,6 +4,7 @@ import (
|
||||
xs "github.com/huandu/xstrings"
|
||||
term "github.com/nsf/termbox-go"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
type attr struct {
|
||||
@ -274,7 +275,13 @@ func DrawText(x, y int, text string) {
|
||||
SetTextColor(elem.Fg)
|
||||
SetBackColor(elem.Bg)
|
||||
drawn := PutChar(x, y, elem.Ch)
|
||||
x += 1
|
||||
|
||||
if unicode.Is(unicode.Scripts["Han"], elem.Ch){
|
||||
x += 2
|
||||
} else {
|
||||
x += 1
|
||||
}
|
||||
|
||||
if firstdrawn && !drawn {
|
||||
break
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user