aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-06-26 23:36:23 +0200
committerBoris Faure <billiob@gmail.com>2017-06-26 23:36:23 +0200
commitb0226726f8ea6b55ddd2e5a539da9d1798d23345 (patch)
treeab5dcfffc9e8c5bae0b8a914975ae0488d5d1381
parenttermpty: DECERA only changes codepoints (diff)
downloadterminology-b0226726f8ea6b55ddd2e5a539da9d1798d23345.tar.gz
termpty: correctly handle DECFRA wrt SGR 0
-rw-r--r--src/bin/termpty.c25
-rw-r--r--src/bin/termptyesc.c2
-rw-r--r--src/bin/termptyops.h2
3 files changed, 28 insertions, 1 deletions
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 2357576..5ef82f1 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1597,6 +1597,31 @@ termpty_cells_set_content(Termpty *ty, Termcell *cells,
}
}
+void
+termpty_cells_att_fill_preserve_colors(Termpty *ty, Termcell *cells,
+ Eina_Unicode codepoint, int count)
+{
+ int i;
+ Termcell local = { .codepoint = codepoint, .att = ty->termstate.att};
+
+ for (i = 0; i < count; i++)
+ {
+ Termatt att = cells[i].att;
+ _handle_block_codepoint_overwrite(ty, cells[i].codepoint, codepoint);
+ cells[i] = local;
+ if (ty->termstate.att.fg == 0 && ty->termstate.att.bg == 0)
+ {
+ cells[i].att.fg = att.fg;
+ cells[i].att.fg256 = att.fg256;
+ cells[i].att.fgintense = att.fgintense;
+
+ cells[i].att.bg = att.bg;
+ cells[i].att.bg256 = att.bg256;
+ cells[i].att.bgintense = att.bgintense;
+ }
+ }
+}
+
void
termpty_cell_codepoint_att_fill(Termpty *ty, Eina_Unicode codepoint,
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 6794d2c..aef05eb 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -907,7 +907,7 @@ _handle_esc_csi_decfra(Termpty *ty, Eina_Unicode **b)
for (; top <= bottom; top++)
{
Termcell *cells = &(TERMPTY_SCREEN(ty, left, top));
- termpty_cells_fill(ty, c, cells, len);
+ termpty_cells_att_fill_preserve_colors(ty, cells, c, len);
}
}
diff --git a/src/bin/termptyops.h b/src/bin/termptyops.h
index 177fab0..7046d5b 100644
--- a/src/bin/termptyops.h
+++ b/src/bin/termptyops.h
@@ -12,6 +12,8 @@ void termpty_text_save_top(Termpty *ty, Termcell *cells, ssize_t w_max);
void termpty_cells_copy(Termpty *ty, Termcell *cells, Termcell *dest, int count);
void termpty_cells_fill(Termpty *ty, Eina_Unicode codepoint, Termcell *cells, int count);
void termpty_cells_clear(Termpty *ty, Termcell *cells, int count);
+void termpty_cells_att_fill_preserve_colors(Termpty *ty, Termcell *cells,
+ Eina_Unicode codepoint, int count);
void termpty_text_scroll(Termpty *ty, Eina_Bool clear);
void termpty_text_scroll_rev(Termpty *ty, Eina_Bool clear);
void termpty_text_scroll_test(Termpty *ty, Eina_Bool clear);