about summary refs log tree commit diff stats
path: root/widgets/terminal.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-04-15 16:07:05 -0400
committerDrew DeVault <sir@cmpwn.com>2019-04-15 16:07:05 -0400
commit2925bdfd6c55de5e20cec9f689708d97855a1d08 (patch)
tree0535bd1430fe3d11dc216a7e68c297d69d2f9f50 /widgets/terminal.go
parent3cd0d5bc284985703a3eb1c2eae3c14a28f7200b (diff)
downloadaerc-2925bdfd6c55de5e20cec9f689708d97855a1d08.tar.gz
Re-render terminal on invalidate
Diffstat (limited to 'widgets/terminal.go')
-rw-r--r--widgets/terminal.go17
1 files 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
 }