@akiojin/gwt 9.7.0 → 9.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +37 -6
- package/README.md +38 -8
- package/assets/icons/icon.icns +0 -0
- package/assets/icons/icon.ico +0 -0
- package/assets/icons/icon.png +0 -0
- package/assets/release-assets.json +18 -0
- package/docker-compose.yml +2 -2
- package/package.json +6 -3
- package/scripts/check-release-flow.sh +17 -0
- package/scripts/release-assets.cjs +11 -0
- package/scripts/test-all.sh +15 -1
- package/scripts/test_release_assets.cjs +67 -0
- package/vendor/vt100/LICENSE +21 -0
- package/vendor/vt100/src/attrs.rs +144 -0
- package/vendor/vt100/src/callbacks.rs +69 -0
- package/vendor/vt100/src/cell.rs +179 -0
- package/vendor/vt100/src/grid.rs +742 -0
- package/vendor/vt100/src/lib.rs +64 -0
- package/vendor/vt100/src/parser.rs +96 -0
- package/vendor/vt100/src/perform.rs +277 -0
- package/vendor/vt100/src/row.rs +488 -0
- package/vendor/vt100/src/screen.rs +1354 -0
- package/vendor/vt100/src/term.rs +551 -0
- package/wix/main.wxs +40 -5
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
use crate::term::BufWrite as _;
|
|
2
|
+
|
|
3
|
+
#[derive(Clone, Debug)]
|
|
4
|
+
pub struct Row {
|
|
5
|
+
cells: Vec<crate::Cell>,
|
|
6
|
+
wrapped: bool,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
impl Row {
|
|
10
|
+
pub fn new(cols: u16) -> Self {
|
|
11
|
+
Self {
|
|
12
|
+
cells: vec![crate::Cell::new(); usize::from(cols)],
|
|
13
|
+
wrapped: false,
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fn cols(&self) -> u16 {
|
|
18
|
+
self.cells
|
|
19
|
+
.len()
|
|
20
|
+
.try_into()
|
|
21
|
+
// we limit the number of cols to a u16 (see Size)
|
|
22
|
+
.unwrap()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pub fn clear(&mut self, attrs: crate::attrs::Attrs) {
|
|
26
|
+
for cell in &mut self.cells {
|
|
27
|
+
cell.clear(attrs);
|
|
28
|
+
}
|
|
29
|
+
self.wrapped = false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
fn cells(&self) -> impl Iterator<Item = &crate::Cell> {
|
|
33
|
+
self.cells.iter()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
pub fn get(&self, col: u16) -> Option<&crate::Cell> {
|
|
37
|
+
self.cells.get(usize::from(col))
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
pub fn get_mut(&mut self, col: u16) -> Option<&mut crate::Cell> {
|
|
41
|
+
self.cells.get_mut(usize::from(col))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
pub fn insert(&mut self, i: u16, cell: crate::Cell) {
|
|
45
|
+
self.cells.insert(usize::from(i), cell);
|
|
46
|
+
self.wrapped = false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
pub fn remove(&mut self, i: u16) {
|
|
50
|
+
self.clear_wide(i);
|
|
51
|
+
self.cells.remove(usize::from(i));
|
|
52
|
+
self.wrapped = false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
pub fn erase(&mut self, i: u16, attrs: crate::attrs::Attrs) {
|
|
56
|
+
let wide = self.cells[usize::from(i)].is_wide();
|
|
57
|
+
self.clear_wide(i);
|
|
58
|
+
self.cells[usize::from(i)].clear(attrs);
|
|
59
|
+
if i == self.cols() - if wide { 2 } else { 1 } {
|
|
60
|
+
self.wrapped = false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
pub fn truncate(&mut self, len: u16) {
|
|
65
|
+
self.cells.truncate(usize::from(len));
|
|
66
|
+
self.wrapped = false;
|
|
67
|
+
let last_cell = &mut self.cells[usize::from(len) - 1];
|
|
68
|
+
if last_cell.is_wide() {
|
|
69
|
+
last_cell.clear(*last_cell.attrs());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub fn resize(&mut self, len: u16, cell: crate::Cell) {
|
|
74
|
+
match len.cmp(&self.cols()) {
|
|
75
|
+
std::cmp::Ordering::Less if len == 0 => {
|
|
76
|
+
self.cells.clear();
|
|
77
|
+
self.wrapped = false;
|
|
78
|
+
}
|
|
79
|
+
// Shrinking must sanitize a trailing wide glyph whose
|
|
80
|
+
// continuation cell gets truncated away.
|
|
81
|
+
std::cmp::Ordering::Less => self.truncate(len),
|
|
82
|
+
std::cmp::Ordering::Greater => {
|
|
83
|
+
self.cells.resize(usize::from(len), cell);
|
|
84
|
+
self.wrapped = false;
|
|
85
|
+
}
|
|
86
|
+
std::cmp::Ordering::Equal => {
|
|
87
|
+
self.wrapped = false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
pub fn wrap(&mut self, wrap: bool) {
|
|
93
|
+
self.wrapped = wrap;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
pub fn wrapped(&self) -> bool {
|
|
97
|
+
self.wrapped
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
pub fn clear_wide(&mut self, col: u16) {
|
|
101
|
+
let cell = &self.cells[usize::from(col)];
|
|
102
|
+
let other = if cell.is_wide() {
|
|
103
|
+
&mut self.cells[usize::from(col + 1)]
|
|
104
|
+
} else if cell.is_wide_continuation() {
|
|
105
|
+
&mut self.cells[usize::from(col - 1)]
|
|
106
|
+
} else {
|
|
107
|
+
return;
|
|
108
|
+
};
|
|
109
|
+
other.clear(*other.attrs());
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
pub fn write_contents(
|
|
113
|
+
&self,
|
|
114
|
+
contents: &mut String,
|
|
115
|
+
start: u16,
|
|
116
|
+
width: u16,
|
|
117
|
+
wrapping: bool,
|
|
118
|
+
) {
|
|
119
|
+
let mut prev_was_wide = false;
|
|
120
|
+
|
|
121
|
+
let mut prev_col = start;
|
|
122
|
+
for (col, cell) in self
|
|
123
|
+
.cells()
|
|
124
|
+
.enumerate()
|
|
125
|
+
.skip(usize::from(start))
|
|
126
|
+
.take(usize::from(width))
|
|
127
|
+
{
|
|
128
|
+
if prev_was_wide {
|
|
129
|
+
prev_was_wide = false;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
prev_was_wide = cell.is_wide();
|
|
133
|
+
|
|
134
|
+
// we limit the number of cols to a u16 (see Size)
|
|
135
|
+
let col: u16 = col.try_into().unwrap();
|
|
136
|
+
if cell.has_contents() {
|
|
137
|
+
for _ in 0..(col - prev_col) {
|
|
138
|
+
contents.push(' ');
|
|
139
|
+
}
|
|
140
|
+
prev_col += col - prev_col;
|
|
141
|
+
|
|
142
|
+
contents.push_str(cell.contents());
|
|
143
|
+
prev_col += if cell.is_wide() { 2 } else { 1 };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if prev_col == start && wrapping {
|
|
147
|
+
contents.push('\n');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
pub fn write_contents_formatted(
|
|
152
|
+
&self,
|
|
153
|
+
contents: &mut Vec<u8>,
|
|
154
|
+
start: u16,
|
|
155
|
+
width: u16,
|
|
156
|
+
row: u16,
|
|
157
|
+
wrapping: bool,
|
|
158
|
+
prev_pos: Option<crate::grid::Pos>,
|
|
159
|
+
prev_attrs: Option<crate::attrs::Attrs>,
|
|
160
|
+
) -> (crate::grid::Pos, crate::attrs::Attrs) {
|
|
161
|
+
let mut prev_was_wide = false;
|
|
162
|
+
let default_cell = crate::Cell::new();
|
|
163
|
+
|
|
164
|
+
let mut prev_pos = prev_pos.unwrap_or_else(|| {
|
|
165
|
+
if wrapping {
|
|
166
|
+
crate::grid::Pos {
|
|
167
|
+
row: row - 1,
|
|
168
|
+
col: self.cols(),
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
crate::grid::Pos { row, col: start }
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
let mut prev_attrs = prev_attrs.unwrap_or_default();
|
|
175
|
+
|
|
176
|
+
let first_cell = &self.cells[usize::from(start)];
|
|
177
|
+
if wrapping && first_cell == &default_cell {
|
|
178
|
+
let default_attrs = default_cell.attrs();
|
|
179
|
+
if &prev_attrs != default_attrs {
|
|
180
|
+
default_attrs.write_escape_code_diff(contents, &prev_attrs);
|
|
181
|
+
prev_attrs = *default_attrs;
|
|
182
|
+
}
|
|
183
|
+
contents.push(b' ');
|
|
184
|
+
crate::term::Backspace.write_buf(contents);
|
|
185
|
+
crate::term::EraseChar::new(1).write_buf(contents);
|
|
186
|
+
prev_pos = crate::grid::Pos { row, col: 0 };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
let mut erase: Option<(u16, &crate::attrs::Attrs)> = None;
|
|
190
|
+
for (col, cell) in self
|
|
191
|
+
.cells()
|
|
192
|
+
.enumerate()
|
|
193
|
+
.skip(usize::from(start))
|
|
194
|
+
.take(usize::from(width))
|
|
195
|
+
{
|
|
196
|
+
if prev_was_wide {
|
|
197
|
+
prev_was_wide = false;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
prev_was_wide = cell.is_wide();
|
|
201
|
+
|
|
202
|
+
// we limit the number of cols to a u16 (see Size)
|
|
203
|
+
let col: u16 = col.try_into().unwrap();
|
|
204
|
+
let pos = crate::grid::Pos { row, col };
|
|
205
|
+
|
|
206
|
+
if let Some((prev_col, attrs)) = erase {
|
|
207
|
+
if cell.has_contents() || cell.attrs() != attrs {
|
|
208
|
+
let new_pos = crate::grid::Pos { row, col: prev_col };
|
|
209
|
+
if wrapping
|
|
210
|
+
&& prev_pos.row + 1 == new_pos.row
|
|
211
|
+
&& prev_pos.col >= self.cols()
|
|
212
|
+
{
|
|
213
|
+
if new_pos.col > 0 {
|
|
214
|
+
contents.extend(
|
|
215
|
+
" ".repeat(usize::from(new_pos.col))
|
|
216
|
+
.as_bytes(),
|
|
217
|
+
);
|
|
218
|
+
} else {
|
|
219
|
+
contents.extend(b" ");
|
|
220
|
+
crate::term::Backspace.write_buf(contents);
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
crate::term::MoveFromTo::new(prev_pos, new_pos)
|
|
224
|
+
.write_buf(contents);
|
|
225
|
+
}
|
|
226
|
+
prev_pos = new_pos;
|
|
227
|
+
if &prev_attrs != attrs {
|
|
228
|
+
attrs.write_escape_code_diff(contents, &prev_attrs);
|
|
229
|
+
prev_attrs = *attrs;
|
|
230
|
+
}
|
|
231
|
+
crate::term::EraseChar::new(pos.col - prev_col)
|
|
232
|
+
.write_buf(contents);
|
|
233
|
+
erase = None;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if cell != &default_cell {
|
|
238
|
+
let attrs = cell.attrs();
|
|
239
|
+
if cell.has_contents() {
|
|
240
|
+
if pos != prev_pos {
|
|
241
|
+
if !wrapping
|
|
242
|
+
|| prev_pos.row + 1 != pos.row
|
|
243
|
+
|| prev_pos.col
|
|
244
|
+
< self.cols() - u16::from(cell.is_wide())
|
|
245
|
+
|| pos.col != 0
|
|
246
|
+
{
|
|
247
|
+
crate::term::MoveFromTo::new(prev_pos, pos)
|
|
248
|
+
.write_buf(contents);
|
|
249
|
+
}
|
|
250
|
+
prev_pos = pos;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if &prev_attrs != attrs {
|
|
254
|
+
attrs.write_escape_code_diff(contents, &prev_attrs);
|
|
255
|
+
prev_attrs = *attrs;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
prev_pos.col += if cell.is_wide() { 2 } else { 1 };
|
|
259
|
+
let cell_contents = cell.contents();
|
|
260
|
+
contents.extend(cell_contents.as_bytes());
|
|
261
|
+
} else if erase.is_none() {
|
|
262
|
+
erase = Some((pos.col, attrs));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if let Some((prev_col, attrs)) = erase {
|
|
267
|
+
let new_pos = crate::grid::Pos { row, col: prev_col };
|
|
268
|
+
if wrapping
|
|
269
|
+
&& prev_pos.row + 1 == new_pos.row
|
|
270
|
+
&& prev_pos.col >= self.cols()
|
|
271
|
+
{
|
|
272
|
+
if new_pos.col > 0 {
|
|
273
|
+
contents.extend(
|
|
274
|
+
" ".repeat(usize::from(new_pos.col)).as_bytes(),
|
|
275
|
+
);
|
|
276
|
+
} else {
|
|
277
|
+
contents.extend(b" ");
|
|
278
|
+
crate::term::Backspace.write_buf(contents);
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
crate::term::MoveFromTo::new(prev_pos, new_pos)
|
|
282
|
+
.write_buf(contents);
|
|
283
|
+
}
|
|
284
|
+
prev_pos = new_pos;
|
|
285
|
+
if &prev_attrs != attrs {
|
|
286
|
+
attrs.write_escape_code_diff(contents, &prev_attrs);
|
|
287
|
+
prev_attrs = *attrs;
|
|
288
|
+
}
|
|
289
|
+
crate::term::ClearRowForward.write_buf(contents);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
(prev_pos, prev_attrs)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// while it's true that most of the logic in this is identical to
|
|
296
|
+
// write_contents_formatted, i can't figure out how to break out the
|
|
297
|
+
// common parts without making things noticeably slower.
|
|
298
|
+
pub fn write_contents_diff(
|
|
299
|
+
&self,
|
|
300
|
+
contents: &mut Vec<u8>,
|
|
301
|
+
prev: &Self,
|
|
302
|
+
start: u16,
|
|
303
|
+
width: u16,
|
|
304
|
+
row: u16,
|
|
305
|
+
wrapping: bool,
|
|
306
|
+
prev_wrapping: bool,
|
|
307
|
+
mut prev_pos: crate::grid::Pos,
|
|
308
|
+
mut prev_attrs: crate::attrs::Attrs,
|
|
309
|
+
) -> (crate::grid::Pos, crate::attrs::Attrs) {
|
|
310
|
+
let mut prev_was_wide = false;
|
|
311
|
+
|
|
312
|
+
let first_cell = &self.cells[usize::from(start)];
|
|
313
|
+
let prev_first_cell = &prev.cells[usize::from(start)];
|
|
314
|
+
if wrapping
|
|
315
|
+
&& !prev_wrapping
|
|
316
|
+
&& first_cell == prev_first_cell
|
|
317
|
+
&& prev_pos.row + 1 == row
|
|
318
|
+
&& prev_pos.col
|
|
319
|
+
>= self.cols() - u16::from(prev_first_cell.is_wide())
|
|
320
|
+
{
|
|
321
|
+
let first_cell_attrs = first_cell.attrs();
|
|
322
|
+
if &prev_attrs != first_cell_attrs {
|
|
323
|
+
first_cell_attrs
|
|
324
|
+
.write_escape_code_diff(contents, &prev_attrs);
|
|
325
|
+
prev_attrs = *first_cell_attrs;
|
|
326
|
+
}
|
|
327
|
+
let mut cell_contents = prev_first_cell.contents();
|
|
328
|
+
let need_erase = if cell_contents.is_empty() {
|
|
329
|
+
cell_contents = " ";
|
|
330
|
+
true
|
|
331
|
+
} else {
|
|
332
|
+
false
|
|
333
|
+
};
|
|
334
|
+
contents.extend(cell_contents.as_bytes());
|
|
335
|
+
crate::term::Backspace.write_buf(contents);
|
|
336
|
+
if prev_first_cell.is_wide() {
|
|
337
|
+
crate::term::Backspace.write_buf(contents);
|
|
338
|
+
}
|
|
339
|
+
if need_erase {
|
|
340
|
+
crate::term::EraseChar::new(1).write_buf(contents);
|
|
341
|
+
}
|
|
342
|
+
prev_pos = crate::grid::Pos { row, col: 0 };
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
let mut erase: Option<(u16, &crate::attrs::Attrs)> = None;
|
|
346
|
+
for (col, (cell, prev_cell)) in self
|
|
347
|
+
.cells()
|
|
348
|
+
.zip(prev.cells())
|
|
349
|
+
.enumerate()
|
|
350
|
+
.skip(usize::from(start))
|
|
351
|
+
.take(usize::from(width))
|
|
352
|
+
{
|
|
353
|
+
if prev_was_wide {
|
|
354
|
+
prev_was_wide = false;
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
prev_was_wide = cell.is_wide();
|
|
358
|
+
|
|
359
|
+
// we limit the number of cols to a u16 (see Size)
|
|
360
|
+
let col: u16 = col.try_into().unwrap();
|
|
361
|
+
let pos = crate::grid::Pos { row, col };
|
|
362
|
+
|
|
363
|
+
if let Some((prev_col, attrs)) = erase {
|
|
364
|
+
if cell.has_contents() || cell.attrs() != attrs {
|
|
365
|
+
let new_pos = crate::grid::Pos { row, col: prev_col };
|
|
366
|
+
if wrapping
|
|
367
|
+
&& prev_pos.row + 1 == new_pos.row
|
|
368
|
+
&& prev_pos.col >= self.cols()
|
|
369
|
+
{
|
|
370
|
+
if new_pos.col > 0 {
|
|
371
|
+
contents.extend(
|
|
372
|
+
" ".repeat(usize::from(new_pos.col))
|
|
373
|
+
.as_bytes(),
|
|
374
|
+
);
|
|
375
|
+
} else {
|
|
376
|
+
contents.extend(b" ");
|
|
377
|
+
crate::term::Backspace.write_buf(contents);
|
|
378
|
+
}
|
|
379
|
+
} else {
|
|
380
|
+
crate::term::MoveFromTo::new(prev_pos, new_pos)
|
|
381
|
+
.write_buf(contents);
|
|
382
|
+
}
|
|
383
|
+
prev_pos = new_pos;
|
|
384
|
+
if &prev_attrs != attrs {
|
|
385
|
+
attrs.write_escape_code_diff(contents, &prev_attrs);
|
|
386
|
+
prev_attrs = *attrs;
|
|
387
|
+
}
|
|
388
|
+
crate::term::EraseChar::new(pos.col - prev_col)
|
|
389
|
+
.write_buf(contents);
|
|
390
|
+
erase = None;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if cell != prev_cell {
|
|
395
|
+
let attrs = cell.attrs();
|
|
396
|
+
if cell.has_contents() {
|
|
397
|
+
if pos != prev_pos {
|
|
398
|
+
if !wrapping
|
|
399
|
+
|| prev_pos.row + 1 != pos.row
|
|
400
|
+
|| prev_pos.col
|
|
401
|
+
< self.cols() - u16::from(cell.is_wide())
|
|
402
|
+
|| pos.col != 0
|
|
403
|
+
{
|
|
404
|
+
crate::term::MoveFromTo::new(prev_pos, pos)
|
|
405
|
+
.write_buf(contents);
|
|
406
|
+
}
|
|
407
|
+
prev_pos = pos;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if &prev_attrs != attrs {
|
|
411
|
+
attrs.write_escape_code_diff(contents, &prev_attrs);
|
|
412
|
+
prev_attrs = *attrs;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
prev_pos.col += if cell.is_wide() { 2 } else { 1 };
|
|
416
|
+
contents.extend(cell.contents().as_bytes());
|
|
417
|
+
} else if erase.is_none() {
|
|
418
|
+
erase = Some((pos.col, attrs));
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if let Some((prev_col, attrs)) = erase {
|
|
423
|
+
let new_pos = crate::grid::Pos { row, col: prev_col };
|
|
424
|
+
if wrapping
|
|
425
|
+
&& prev_pos.row + 1 == new_pos.row
|
|
426
|
+
&& prev_pos.col >= self.cols()
|
|
427
|
+
{
|
|
428
|
+
if new_pos.col > 0 {
|
|
429
|
+
contents.extend(
|
|
430
|
+
" ".repeat(usize::from(new_pos.col)).as_bytes(),
|
|
431
|
+
);
|
|
432
|
+
} else {
|
|
433
|
+
contents.extend(b" ");
|
|
434
|
+
crate::term::Backspace.write_buf(contents);
|
|
435
|
+
}
|
|
436
|
+
} else {
|
|
437
|
+
crate::term::MoveFromTo::new(prev_pos, new_pos)
|
|
438
|
+
.write_buf(contents);
|
|
439
|
+
}
|
|
440
|
+
prev_pos = new_pos;
|
|
441
|
+
if &prev_attrs != attrs {
|
|
442
|
+
attrs.write_escape_code_diff(contents, &prev_attrs);
|
|
443
|
+
prev_attrs = *attrs;
|
|
444
|
+
}
|
|
445
|
+
crate::term::ClearRowForward.write_buf(contents);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// if this row is going from wrapped to not wrapped, we need to erase
|
|
449
|
+
// and redraw the last character to break wrapping. if this row is
|
|
450
|
+
// wrapped, we need to redraw the last character without erasing it to
|
|
451
|
+
// position the cursor after the end of the line correctly so that
|
|
452
|
+
// drawing the next line can just start writing and be wrapped.
|
|
453
|
+
if (!self.wrapped && prev.wrapped) || (!prev.wrapped && self.wrapped)
|
|
454
|
+
{
|
|
455
|
+
let end_pos = if self.cells[usize::from(self.cols() - 1)]
|
|
456
|
+
.is_wide_continuation()
|
|
457
|
+
{
|
|
458
|
+
crate::grid::Pos {
|
|
459
|
+
row,
|
|
460
|
+
col: self.cols() - 2,
|
|
461
|
+
}
|
|
462
|
+
} else {
|
|
463
|
+
crate::grid::Pos {
|
|
464
|
+
row,
|
|
465
|
+
col: self.cols() - 1,
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
crate::term::MoveFromTo::new(prev_pos, end_pos)
|
|
469
|
+
.write_buf(contents);
|
|
470
|
+
prev_pos = end_pos;
|
|
471
|
+
if !self.wrapped {
|
|
472
|
+
crate::term::EraseChar::new(1).write_buf(contents);
|
|
473
|
+
}
|
|
474
|
+
let end_cell = &self.cells[usize::from(end_pos.col)];
|
|
475
|
+
if end_cell.has_contents() {
|
|
476
|
+
let attrs = end_cell.attrs();
|
|
477
|
+
if &prev_attrs != attrs {
|
|
478
|
+
attrs.write_escape_code_diff(contents, &prev_attrs);
|
|
479
|
+
prev_attrs = *attrs;
|
|
480
|
+
}
|
|
481
|
+
contents.extend(end_cell.contents().as_bytes());
|
|
482
|
+
prev_pos.col += if end_cell.is_wide() { 2 } else { 1 };
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
(prev_pos, prev_attrs)
|
|
487
|
+
}
|
|
488
|
+
}
|