patch 8.1.0760: no proper test for using 'termencoding'
Problem: No proper test for using 'termencoding'.
Solution: Add a screendump test. Fix using double width characters in a
screendump.
diff --git a/src/terminal.c b/src/terminal.c
index dbb8f2c..09b6072 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -4031,7 +4031,6 @@
if (cell.width == 2)
{
fputs("*", fd);
- ++pos.col;
}
else
fputs("+", fd);
@@ -4062,6 +4061,9 @@
prev_cell = cell;
}
+
+ if (cell.width == 2)
+ ++pos.col;
}
if (repeat > 0)
fprintf(fd, "@%d", repeat);
@@ -4103,6 +4105,7 @@
char_u *prev_char = NULL;
int attr = 0;
cellattr_T cell;
+ cellattr_T empty_cell;
term_T *term = curbuf->b_term;
int max_cells = 0;
int start_row = term->tl_scrollback.ga_len;
@@ -4110,6 +4113,7 @@
ga_init2(&ga_text, 1, 90);
ga_init2(&ga_cell, sizeof(cellattr_T), 90);
vim_memset(&cell, 0, sizeof(cell));
+ vim_memset(&empty_cell, 0, sizeof(empty_cell));
cursor_pos->row = -1;
cursor_pos->col = -1;
@@ -4208,66 +4212,68 @@
c = fgetc(fd);
}
hl2vtermAttr(attr, &cell);
+
+ /* is_bg == 0: fg, is_bg == 1: bg */
+ for (is_bg = 0; is_bg <= 1; ++is_bg)
+ {
+ if (c == '&')
+ {
+ /* use same color as previous cell */
+ c = fgetc(fd);
+ }
+ else if (c == '#')
+ {
+ int red, green, blue, index = 0;
+
+ c = fgetc(fd);
+ red = hex2nr(c);
+ c = fgetc(fd);
+ red = (red << 4) + hex2nr(c);
+ c = fgetc(fd);
+ green = hex2nr(c);
+ c = fgetc(fd);
+ green = (green << 4) + hex2nr(c);
+ c = fgetc(fd);
+ blue = hex2nr(c);
+ c = fgetc(fd);
+ blue = (blue << 4) + hex2nr(c);
+ c = fgetc(fd);
+ if (!isdigit(c))
+ dump_is_corrupt(&ga_text);
+ while (isdigit(c))
+ {
+ index = index * 10 + (c - '0');
+ c = fgetc(fd);
+ }
+
+ if (is_bg)
+ {
+ cell.bg.red = red;
+ cell.bg.green = green;
+ cell.bg.blue = blue;
+ cell.bg.ansi_index = index;
+ }
+ else
+ {
+ cell.fg.red = red;
+ cell.fg.green = green;
+ cell.fg.blue = blue;
+ cell.fg.ansi_index = index;
+ }
+ }
+ else
+ dump_is_corrupt(&ga_text);
+ }
}
else
dump_is_corrupt(&ga_text);
-
- /* is_bg == 0: fg, is_bg == 1: bg */
- for (is_bg = 0; is_bg <= 1; ++is_bg)
- {
- if (c == '&')
- {
- /* use same color as previous cell */
- c = fgetc(fd);
- }
- else if (c == '#')
- {
- int red, green, blue, index = 0;
-
- c = fgetc(fd);
- red = hex2nr(c);
- c = fgetc(fd);
- red = (red << 4) + hex2nr(c);
- c = fgetc(fd);
- green = hex2nr(c);
- c = fgetc(fd);
- green = (green << 4) + hex2nr(c);
- c = fgetc(fd);
- blue = hex2nr(c);
- c = fgetc(fd);
- blue = (blue << 4) + hex2nr(c);
- c = fgetc(fd);
- if (!isdigit(c))
- dump_is_corrupt(&ga_text);
- while (isdigit(c))
- {
- index = index * 10 + (c - '0');
- c = fgetc(fd);
- }
-
- if (is_bg)
- {
- cell.bg.red = red;
- cell.bg.green = green;
- cell.bg.blue = blue;
- cell.bg.ansi_index = index;
- }
- else
- {
- cell.fg.red = red;
- cell.fg.green = green;
- cell.fg.blue = blue;
- cell.fg.ansi_index = index;
- }
- }
- else
- dump_is_corrupt(&ga_text);
- }
}
else
dump_is_corrupt(&ga_text);
append_cell(&ga_cell, &cell);
+ if (cell.width == 2)
+ append_cell(&ga_cell, &empty_cell);
}
else if (c == '@')
{