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>
This commit is contained in:
parent
da10dae86e
commit
c4a9f3f8a0
1 changed files with 3 additions and 0 deletions
|
@ -178,6 +178,9 @@ func (term *Terminal) HandleEvent(ev tcell.Event) bool {
|
||||||
}
|
}
|
||||||
switch ev := ev.(type) {
|
switch ev := ev.(type) {
|
||||||
case *views.EventWidgetContent:
|
case *views.EventWidgetContent:
|
||||||
|
if !term.focus {
|
||||||
|
return false
|
||||||
|
}
|
||||||
// Draw here for performance improvement. We call draw again in
|
// Draw here for performance improvement. We call draw again in
|
||||||
// the main Draw, but tcell-term only draws dirty cells, so it
|
// the main Draw, but tcell-term only draws dirty cells, so it
|
||||||
// won't be too much extra CPU there. Drawing there is needed
|
// won't be too much extra CPU there. Drawing there is needed
|
||||||
|
|
Loading…
Reference in a new issue