コード例 #1
0
func printMsgf(term Terminal, x, y int, fg, bg uint16, format string, args ...interface{}) {
	msg := fmt.Sprintf(format, args...)
	for _, c := range msg {
		term.SetCell(x, y, c, fg, bg)
		x += runewidth.RuneWidth(c)
	}
}
コード例 #2
0
ファイル: bench_test.go プロジェクト: lucy/runewidth
func BenchmarkOtherlib1(b *testing.B) {
	for n := 0; n < b.N; n++ {
		_ = mattn.RuneWidth('コ')
	}
}
コード例 #3
0
ファイル: helper.go プロジェクト: j4ustin/go-ethereum
func charWidth(ch rune) int {
	return rw.RuneWidth(ch)
}