about summary refs log tree commit diff stats
path: root/widgets
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
parent960d11c4bc2e8343f1369de43e2323ae1fcfb7c1 (diff)
downloadaerc-a602891768d0272c8688731752f491eb92668d7d.tar.gz
term: don't mess with cursor when unfocused
Diffstat (limited to 'widgets')
-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 {
; 2019-12-09 01:26:58 -0800 5806' href='/akkartik/mu/commit/html/apps/random.subx.html?h=main&id=8aeb85f04ee68b960a6d326aca1a17dec2f6d019'>8aeb85f0 ^
0bb09d2e ^







33352536 ^
0bb09d2e ^
4a4a392d ^
0bb09d2e ^

33352536 ^

0bb09d2e ^














1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124