mirror of https://github.com/jroimartin/gocui.git
Minor fixes in Wrap
Print first character of the new line. Control maxX and maxY to avoid invalid calls to View.SetRune. Add error handling when calling View.SetRune.
This commit is contained in:
parent
382efdcc54
commit
f78a0704f1
10
view.go
10
view.go
|
@ -189,19 +189,21 @@ func (v *View) draw() error {
|
||||||
if x == maxX && v.Wrap {
|
if x == maxX && v.Wrap {
|
||||||
x = 0
|
x = 0
|
||||||
y++
|
y++
|
||||||
for _, p := range v.WrapPrefix {
|
for _, p := range v.WrapPrefix + string(ch) {
|
||||||
if x == maxX {
|
if x >= maxX || y >= maxY {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
v.setRune(x, y, p)
|
if err := v.setRune(x, y, p); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
x++
|
x++
|
||||||
}
|
}
|
||||||
} else if x < maxX && y < maxY {
|
} else if x < maxX && y < maxY {
|
||||||
if err := v.setRune(x, y, ch); err != nil {
|
if err := v.setRune(x, y, ch); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
x++
|
||||||
}
|
}
|
||||||
x++
|
|
||||||
}
|
}
|
||||||
y++
|
y++
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue