summary refs log tree commit diff stats
path: root/widgets/terminal.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/terminal.go')
-rw-r--r--widgets/terminal.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/widgets/terminal.go b/widgets/terminal.go
index 4a339cc..e7286f9 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)
+		}
 	}
 }