aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-09-25 14:24:55 -0500
committerRobin Jarry <robin@jarry.cc>2022-09-26 17:31:05 +0200
commitc4a9f3f8a0b8a78410489f4bae032402d713c9a0 (patch)
tree863eba5923b13e86f0c485f114d3ce3131afe55d /widgets
parentda10dae86e9d422f7029de5612ddbdc0a2be86c2 (diff)
downloadaerc-c4a9f3f8a0b8a78410489f4bae032402d713c9a0.tar.gz
terminal: prevent draw loop when unfocused
If a :term is open and aerc is focused on another tab, it is possible for the :term to redraw itself to the screen. Only allow terminal to redraw itself when it is focused. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/terminal.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/widgets/terminal.go b/widgets/terminal.go
index 279c2a33..5c67e32a 100644
--- a/widgets/terminal.go
+++ b/widgets/terminal.go
@@ -178,6 +178,9 @@ func (term *Terminal) HandleEvent(ev tcell.Event) bool {
}
switch ev := ev.(type) {
case *views.EventWidgetContent:
+ if !term.focus {
+ return false
+ }
// Draw here for performance improvement. We call draw again in
// the main Draw, but tcell-term only draws dirty cells, so it
// won't be too much extra CPU there. Drawing there is needed