dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 30701f405718ff00f530e13b974a9e2503b41841
parent 27ce6bd5d11b54bb168bffa4deae91d7fc240478
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 30 Jul 2015 17:36:55 +0200

vt: make switch between normal/alternate buffer more compliant

Switching from alternate mode to normal mode should clear the
content of the alternate screen.

The other, cursor related, issues mentioned in commit
87177861f90bb1c6cdf5c4b2282716723ccc599d are still unfixed.

Diffstat:
vt.c | 30++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/vt.c b/vt.c @@ -294,6 +294,24 @@ static void row_roll(Row *start, Row *end, int count) } } +static void buffer_clear(Buffer *b) +{ + Cell cell = { + .text = L'\0', + .attr = A_NORMAL, + .fg = -1, + .bg = -1, + }; + + for (int i = 0; i < b->rows; i++) { + Row *row = b->lines + i; + for (int j = 0; j < b->cols; j++) { + row->cells[i] = cell; + row->dirty = true; + } + } +} + static void buffer_free(Buffer *b) { for (int i = 0; i < b->rows; i++) @@ -947,13 +965,17 @@ static void interpret_csi_priv_mode(Vt *t, int param[], int pcount, bool set) case 25: /* make cursor visible/invisible (DECCM) */ t->curshid = !set; break; - case 47: /* use alternate/normal screen buffer */ + case 1049: /* combine 1047 + 1048 */ + case 47: /* use alternate/normal screen buffer */ case 1047: - case 1049: + if (!set) + buffer_clear(&t->buffer_alternate); t->buffer = set ? &t->buffer_alternate : &t->buffer_normal; vt_dirty(t); - break; - case 1048: + if (param[i] != 1049) + break; + /* fall through */ + case 1048: /* save/restore cursor */ if (set) cursor_save(t); else