From 4179b4242411f41a22d9743b4eff3b19ef69b3e8 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 13 Oct 2016 20:27:27 +0000 Subject: Add support for BCE (background colour erase). This makes various escape sequences (notable EL and ED but also IL, DL, ICH, DCH) create blank cells using the current background colour rather than the default colour. On modern systems BCE doesn't really have many benefits, but most other terminals now support it, some (lazy) applications rely on it, and it is not hard to include now that we have pane background colours anyway. Mostly written by Sean Haugh. --- input.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index c3bd6510..dd57e7f4 100644 --- a/input.c +++ b/input.c @@ -1283,7 +1283,8 @@ input_csi_dispatch(struct input_ctx *ictx) screen_write_clearcharacter(sctx, input_get(ictx, 0, 1, 1)); break; case INPUT_CSI_DCH: - screen_write_deletecharacter(sctx, input_get(ictx, 0, 1, 1)); + screen_write_deletecharacter(sctx, input_get(ictx, 0, 1, 1), + ictx->cell.cell.bg); break; case INPUT_CSI_DECSTBM: n = input_get(ictx, 0, 1, 1); @@ -1291,7 +1292,8 @@ input_csi_dispatch(struct input_ctx *ictx) screen_write_scrollregion(sctx, n - 1, m - 1); break; case INPUT_CSI_DL: - screen_write_deleteline(sctx, input_get(ictx, 0, 1, 1)); + screen_write_deleteline(sctx, input_get(ictx, 0, 1, 1), + ictx->cell.cell.bg); break; case INPUT_CSI_DSR: switch (input_get(ictx, 0, 0, 0)) { @@ -1309,13 +1311,13 @@ input_csi_dispatch(struct input_ctx *ictx) case INPUT_CSI_ED: switch (input_get(ictx, 0, 0, 0)) { case 0: - screen_write_clearendofscreen(sctx); + screen_write_clearendofscreen(sctx, ictx->cell.cell.bg); break; case 1: screen_write_clearstartofscreen(sctx); break; case 2: - screen_write_clearscreen(sctx); + screen_write_clearscreen(sctx, ictx->cell.cell.bg); break; case 3: switch (input_get(ictx, 1, 0, 0)) { @@ -1336,13 +1338,13 @@ input_csi_dispatch(struct input_ctx *ictx) case INPUT_CSI_EL: switch (input_get(ictx, 0, 0, 0)) { case 0: - screen_write_clearendofline(sctx); + screen_write_clearendofline(sctx, ictx->cell.cell.bg); break; case 1: - screen_write_clearstartofline(sctx); + screen_write_clearstartofline(sctx, ictx->cell.cell.bg); break; case 2: - screen_write_clearline(sctx); + screen_write_clearline(sctx, ictx->cell.cell.bg); break; default: log_debug("%s: unknown '%c'", __func__, ictx->ch); @@ -1354,10 +1356,12 @@ input_csi_dispatch(struct input_ctx *ictx) screen_write_cursormove(sctx, n - 1, s->cy); break; case INPUT_CSI_ICH: - screen_write_insertcharacter(sctx, input_get(ictx, 0, 1, 1)); + screen_write_insertcharacter(sctx, input_get(ictx, 0, 1, 1), + ictx->cell.cell.bg); break; case INPUT_CSI_IL: - screen_write_insertline(sctx, input_get(ictx, 0, 1, 1)); + screen_write_insertline(sctx, input_get(ictx, 0, 1, 1), + ictx->cell.cell.bg); break; case INPUT_CSI_RCP: memcpy(&ictx->cell, &ictx->old_cell, sizeof ictx->cell); @@ -1445,7 +1449,8 @@ input_csi_dispatch_rm_private(struct input_ctx *ictx) break; case 3: /* DECCOLM */ screen_write_cursormove(&ictx->ctx, 0, 0); - screen_write_clearscreen(&ictx->ctx); + screen_write_clearscreen(&ictx->ctx, + ictx->cell.cell.bg); break; case 7: /* DECAWM */ screen_write_mode_clear(&ictx->ctx, MODE_WRAP); @@ -1522,7 +1527,8 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx) break; case 3: /* DECCOLM */ screen_write_cursormove(&ictx->ctx, 0, 0); - screen_write_clearscreen(&ictx->ctx); + screen_write_clearscreen(&ictx->ctx, + ictx->cell.cell.bg); break; case 7: /* DECAWM */ screen_write_mode_set(&ictx->ctx, MODE_WRAP); -- cgit