diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-03-21 21:28:51 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-21 21:28:51 -0400 |
commit | a602891768d0272c8688731752f491eb92668d7d (patch) | |
tree | 5b1b2b547db1c5402a57bc741d5b96f5152211ad /widgets | |
parent | 960d11c4bc2e8343f1369de43e2323ae1fcfb7c1 (diff) | |
download | aerc-a602891768d0272c8688731752f491eb92668d7d.tar.gz |
term: don't mess with cursor when unfocused
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/terminal.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/widgets/terminal.go b/widgets/terminal.go index 4a06c1b..4a339cc 100644 --- a/widgets/terminal.go +++ b/widgets/terminal.go @@ -297,17 +297,26 @@ func (term *Terminal) Draw(ctx *ui.Context) { } } - if !term.cursorShown { - ctx.HideCursor() - } else { - state := term.vterm.ObtainState() - row, col := state.GetCursorPos() - ctx.SetCursor(col, row) + if term.focus { + if !term.cursorShown { + ctx.HideCursor() + } else { + state := term.vterm.ObtainState() + row, col := state.GetCursorPos() + ctx.SetCursor(col, row) + } } } func (term *Terminal) Focus(focus bool) { term.focus = focus + if !term.focus { + term.ctx.HideCursor() + } else { + state := term.vterm.ObtainState() + row, col := state.GetCursorPos() + term.ctx.SetCursor(col, row) + } } func convertMods(mods tcell.ModMask) vterm.Modifier { |