about 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.go21
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 {