diff options
| -rw-r--r-- | tui/draw.go | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/tui/draw.go b/tui/draw.go index 2584171..3772aa0 100644 --- a/tui/draw.go +++ b/tui/draw.go @@ -149,12 +149,6 @@ func Present() error { var p pos for p.y = 0; p.y < s.Height; p.y++ { for p.x = 0; p.x < s.Width; { - if reset { - err := writeCursor(p.x, p.y) - if err != nil { - return err - } - } c := scr.front[p] if c.c == "" { c.c = " " @@ -164,17 +158,14 @@ func Present() error { c.c = " " } if c != scr.back[p] || scr.prevSize != s { + if reset { + writeCursor(p.x, p.y) + } if style != c.style { style = c.style - err := writeStyle(style) - if err != nil { - return err - } - } - _, err := scr.writer.WriteString(c.c) - if err != nil { - return err + writeStyle(style) } + scr.writer.WriteString(c.c) // make sure that the cursor position remains synced even if // the terminal mangles a wide char or grapheme if cw == 1 && len([]rune(c.c)) == 1 { @@ -188,10 +179,7 @@ func Present() error { p.x += cw } } - err := writeCursor(scr.cursor.x, scr.cursor.y) - if err != nil { - return err - } + writeCursor(scr.cursor.x, scr.cursor.y) scr.prevSize = s f := scr.front |
