From 2925bdfd6c55de5e20cec9f689708d97855a1d08 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 15 Apr 2019 16:07:05 -0400 Subject: [PATCH] Re-render terminal on invalidate --- widgets/terminal.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/widgets/terminal.go b/widgets/terminal.go index 2c27955..84f80e3 100644 --- a/widgets/terminal.go +++ b/widgets/terminal.go @@ -134,7 +134,7 @@ func NewTerminal(cmd *exec.Cmd) (*Terminal, error) { } screen.Flush() term.flushTerminal() - term.Invalidate() + term.invalidate() } }() screen.OnDamage = term.onDamage @@ -230,6 +230,15 @@ func (term *Terminal) OnInvalidate(cb func(d ui.Drawable)) { } func (term *Terminal) Invalidate() { + if term.vterm != nil { + width, height := term.vterm.Size() + rect := vterm.NewRect(0, width, 0, height) + term.damage = append(term.damage, *rect) + } + term.invalidate() +} + +func (term *Terminal) invalidate() { if term.onInvalidate != nil { term.onInvalidate(term) } @@ -415,7 +424,7 @@ func (term *Terminal) styleFromCell(cell *vterm.ScreenCell) tcell.Style { func (term *Terminal) onDamage(rect *vterm.Rect) int { term.damage = append(term.damage, *rect) - term.Invalidate() + term.invalidate() return 1 } @@ -428,7 +437,7 @@ func (term *Terminal) onMoveCursor(old *vterm.Pos, } term.cursorPos = *pos - term.Invalidate() + term.invalidate() return 1 } @@ -440,7 +449,7 @@ func (term *Terminal) onSetTermProp(prop int, val *vterm.VTermValue) int { } case vterm.VTERM_PROP_CURSORVISIBLE: term.cursorShown = val.Boolean - term.Invalidate() + term.invalidate() } return 1 }