diff options
Diffstat (limited to 'widgets/terminal.go')
-rw-r--r-- | widgets/terminal.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/widgets/terminal.go b/widgets/terminal.go index 4a339cc4..e7286f96 100644 --- a/widgets/terminal.go +++ b/widgets/terminal.go @@ -310,12 +310,14 @@ func (term *Terminal) Draw(ctx *ui.Context) { 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) + if term.ctx != nil { + if !term.focus { + term.ctx.HideCursor() + } else { + state := term.vterm.ObtainState() + row, col := state.GetCursorPos() + term.ctx.SetCursor(col, row) + } } } |