tconsole: add status bar
This adds a status bar to the bottom of the tconsole. It contains a page
selector and clock.
Change-Id: Ia932fe793ff067f3d096046d8bd93c060bac807a
Reviewed-on: https://review.monogon.dev/c/monogon/+/3381
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/metropolis/node/core/tconsole/draw.go b/metropolis/node/core/tconsole/draw.go
index d88e35b..4fec256 100644
--- a/metropolis/node/core/tconsole/draw.go
+++ b/metropolis/node/core/tconsole/draw.go
@@ -8,13 +8,15 @@
)
// drawText draws a single line of text from left to right, starting at x and y.
-func (c *Console) drawText(x, y int, text string, style tcell.Style) {
+func (c *Console) drawText(x, y int, text string, style tcell.Style) int {
g := uniseg.NewGraphemes(text)
+ xi := 0
for g.Next() {
runes := g.Runes()
- c.screen.SetContent(x, y, runes[0], runes[1:], style)
- x += 1
+ c.screen.SetContent(x+xi, y, runes[0], runes[1:], style)
+ xi += 1
}
+ return xi
}
// drawTextCentered draw a single line of text from left to right, starting at a