v0.5.2 tui: titles and labels drawn a column a rune; an unchanged frame writes nothing
* tui: titles, labels and buttons drawn a column a rune Ten places drew each rune of a title or label at its byte offset, so a string holding runes of more than one byte drew with holes and ran past the width it was measured and truncated to: the Pane title, the Modal title and hint, the Divider label, TabBar titles, Table cells, Form labels, the TextField placeholder, the ConfirmDialog and AlertDialog buttons, and the ProgressOverlay title. Each now draws through Region.Text, which counts columns by rune, within the bound its loop kept; a Form label stays within its label column, as the byte count meant it to. * an unchanged frame writes nothing flush closed every frame with SGR 0, so a frame that changed no cell still sent four bytes, and an app drawing an idle screen kept writing to the terminal. The reset now follows only a frame that wrote cells: the next cell written restates its whole style, and Fini resets on its own. Each widget, given a title such as "● é · ñ", draws it whole where it drew it with holes before; a frame flushed twice writes nothing the second time, where it wrote ESC [ 0 m.
This commit is contained in:
1 parent
e9aeed0be0
commit
d4cc9f2407
12 files changed
+63
-65
No files matched your search
@@ -100,6 +100,7 @@ func (o *outputBuffer) flush(cells []Cell, width, height int) {
|
||||
}
|
||||
|
||||
w := &o.buf
|
||||
start := w.Len()
|
||||
|
||||
for y := 0; y < height; y++ {
|
||||
rowStart := y * width
|
||||
@@ -194,7 +195,10 @@ func (o *outputBuffer) flush(cells []Cell, width, height int) {
|
||||
}
|
||||
}
|
||||
|
||||
w.Write(csiSGR0)
|
||||
// A frame that changed no cell writes nothing, the reset included
|
||||
if w.Len() > start {
|
||||
w.Write(csiSGR0)
|
||||
}
|
||||
o.lastValid = false
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user