summary refs log tree commit diff stats
path: root/widgets/terminal.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-21 21:28:51 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-21 21:28:51 -0400
commita602891768d0272c8688731752f491eb92668d7d (patch)
tree5b1b2b547db1c5402a57bc741d5b96f5152211ad /widgets/terminal.go
parent960d11c4bc2e8343f1369de43e2323ae1fcfb7c1 (diff)
downloadaerc-a602891768d0272c8688731752f491eb92668d7d.tar.gz
term: don't mess with cursor when unfocused
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 {