fixed unicode chars printed wrong in WriteString
This commit is contained in:
parent
011bf8e616
commit
d5ee06e128
@ -3,11 +3,13 @@ package buf2d
|
||||
// WriteString writes a whole string to the buffer at position (x,y)
|
||||
// no word wrap is applied at all. If the string does not fit, it will be truncated
|
||||
func (b *Buffer) WriteString(str string, x, y int) {
|
||||
for dx, r := range str {
|
||||
if x+dx >= b.width {
|
||||
dx := x
|
||||
for _, r := range str {
|
||||
if dx >= b.width {
|
||||
return
|
||||
}
|
||||
b.Set(x+dx, y, r)
|
||||
b.Set(dx, y, r)
|
||||
dx++
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user