summary refs log tree commit diff stats
path: root/lib/ui/tab.go
diff options
context:
space:
mode:
authorMarkus Ongyerth <aerc@ongy.net>2018-06-01 09:58:00 +0200
committerDrew DeVault <sir@cmpwn.com>2018-06-01 16:04:43 -0700
commit80e891a8024ac10a60daa790131e04f0326b0c73 (patch)
tree7a07cc26b2885e43e57e1672d2895c7fae2b173e /lib/ui/tab.go
parent3836d240c9aa26615e7d768a57436d171edc3831 (diff)
downloadaerc-80e891a8024ac10a60daa790131e04f0326b0c73.tar.gz
switch to tcell from termbox
This is a simple mostly straight forward switch to tcell in favor of
termbox.
It uses the tcell native api (not the compat layer) but does not make
use of most features.

Further changes should include moving to tcell's views.TextArea and the
general built in widget behaviour instead of the current ad hoc
implementation.

Regression: Cursor isn't shown in ex-line
Diffstat (limited to 'lib/ui/tab.go')
-rw-r--r--lib/ui/tab.go19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index e6a8aa5..d0635c7 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -1,7 +1,7 @@
 package ui
 
 import (
-	tb "github.com/nsf/termbox-go"
+	"github.com/gdamore/tcell"
 )
 
 type Tabs struct {
@@ -72,21 +72,14 @@ func (tabs *Tabs) Select(index int) {
 func (strip *TabStrip) Draw(ctx *Context) {
 	x := 0
 	for i, tab := range strip.Tabs {
-		cell := tb.Cell{
-			Fg: tb.ColorBlack,
-			Bg: tb.ColorWhite,
-		}
+		style := tcell.StyleDefault.Background(tcell.ColorWhite).Foreground(tcell.ColorBlack)
 		if strip.Selected == i {
-			cell.Fg = tb.ColorDefault
-			cell.Bg = tb.ColorDefault
+			style = style.Reverse(true)
 		}
-		x += ctx.Printf(x, 0, cell, " %s ", tab.Name)
-	}
-	cell := tb.Cell{
-		Fg: tb.ColorBlack,
-		Bg: tb.ColorWhite,
+		x += ctx.Printf(x, 0, style, " %s ", tab.Name)
 	}
-	ctx.Fill(x, 0, ctx.Width()-x, 1, cell)
+	style := tcell.StyleDefault.Background(tcell.ColorWhite).Foreground(tcell.ColorBlack)
+	ctx.Fill(x, 0, ctx.Width()-x, 1, ' ', style)
 }
 
 func (strip *TabStrip) Invalidate() {
8ee'>^
0be82cde ^

dc9afcbd ^
7fd01071 ^
dc9afcbd ^
0be82cde ^
af023b32 ^
9f7f62ed ^
0be82cde ^


75ab8732 ^
6c96a437 ^
f40137f1 ^
75ab8732 ^
0be82cde ^



0be82cde ^
75ab8732 ^

0be82cde ^
dc9afcbd ^
6c96a437 ^
dc9afcbd ^

0be82cde ^


dc9afcbd ^

9a6f8798 ^
dc9afcbd ^




9a6f8798 ^
6c96a437 ^
dc9afcbd ^




9a6f8798 ^
dc9afcbd ^



192d59d3 ^




d52406cc ^
dc9afcbd ^

a2f5a5d3 ^
dc9afcbd ^


192d59d3 ^




d52406cc ^
dc9afcbd ^
38f72faa ^
a2f5a5d3 ^
dc9afcbd ^
38f72faa ^
dc9afcbd ^
192d59d3 ^
dc9afcbd ^
192d59d3 ^

dc9afcbd ^





38f72faa ^
dc9afcbd ^
192d59d3 ^
dc9afcbd ^
192d59d3 ^

dc9afcbd ^

192d59d3 ^
dc9afcbd ^
192d59d3 ^
dc9afcbd ^


78a12c9d ^
49620728 ^
dc9afcbd ^






38f72faa ^
dc9afcbd ^
192d59d3 ^
dc9afcbd ^
192d59d3 ^

dc9afcbd ^
192d59d3 ^
dc9afcbd ^


0be82cde ^




192d59d3 ^
0be82cde ^

192d59d3 ^
0be82cde ^
192d59d3 ^

0be82cde ^





















192d59d3 ^




0be82cde ^














192d59d3 ^
0be82cde ^

192d59d3 ^
0be82cde ^
192d59d3 ^
0be82cde ^
192d59d3 ^
0be82cde ^
















2789e861 ^





















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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246