From eda263319d5f6b4f7392398a42d67f04056c23e1 Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 3 Jan 2023 20:07:08 +0100 Subject: renderdocument: add StyledNodes to backgrounds This makes it possible to e.g. click on this: --- src/buffer/cell.nim | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/buffer') diff --git a/src/buffer/cell.nim b/src/buffer/cell.nim index a5e33645..3d1d32fa 100644 --- a/src/buffer/cell.nim +++ b/src/buffer/cell.nim @@ -4,7 +4,6 @@ import strutils import sugar import css/stylednode -import layout/box import types/color import utils/twtstr @@ -28,7 +27,6 @@ type FormatCell* = object format*: Format pos*: int - computed*: ComputedFormat node*: StyledNode SimpleFormatCell* = object @@ -143,22 +141,11 @@ func findNextFormat*(line: SimpleFlexibleLine, pos: int): SimpleFormatCell = proc addLine*(grid: var FlexibleGrid) = grid.add(FlexibleLine()) -proc insertFormat*(line: var FlexibleLine, pos, i: int, format: Format, computed: ComputedFormat = nil) = - if computed == nil: - line.formats.insert(FormatCell(format: format, pos: pos), i) - else: - line.formats.insert(FormatCell(format: format, computed: computed, node: computed.node, pos: pos), i) - -proc addFormat*(line: var FlexibleLine, pos: int, format: Format) = - line.formats.add(FormatCell(format: format, pos: pos)) +proc insertFormat*(line: var FlexibleLine, pos, i: int, format: Format, node: StyledNode = nil) = + line.formats.insert(FormatCell(format: format, node: node, pos: pos), i) -proc addFormat*(line: var FlexibleLine, pos: int, format: Format, computed: ComputedFormat) = - #if computed != nil and line.formats.len > 0 and line.formats[^1].computed == computed and line.formats[^1].format.bgcolor != format.bgcolor: - # return - if computed == nil: - line.formats.add(FormatCell(format: format, pos: pos)) - else: - line.formats.add(FormatCell(format: format, computed: computed, node: computed.node, pos: pos)) +proc addFormat*(line: var FlexibleLine, pos: int, format: Format, node: StyledNode = nil) = + line.formats.add(FormatCell(format: format, node: node, pos: pos)) template inc_check(i: int) = inc i -- cgit 1.4.1-2-gfad0 sg
path: root/html/085scenario_console.cc.html
blob: 85303787c9b277ad75008d022bb017eddcd08c1b (plain) (blame)
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337