From a602891768d0272c8688731752f491eb92668d7d Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 21 Mar 2019 21:28:51 -0400 Subject: term: don't mess with cursor when unfocused --- widgets/terminal.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'widgets') diff --git a/widgets/terminal.go b/widgets/terminal.go index 4a06c1b6..4a339cc4 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 { -- cgit