dvtm

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

commit 8621e2355e0d18fd394941297683db8ec7b275b2
parent a5d2af79ac290fc2b3dce8b3a0ac9b372fddc9b3
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Fri, 24 Dec 2010 21:22:18 +0100

madtty: implement IND/RI/NEL escape sequences

These escape sequences should perform a scroll up/down if the cursor
is already at the bottom/top margin, however this is not yet implemented.

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
madtty.c | 50++++++++++++++++++++++++++++++++++++++------------
1 file changed, 38 insertions(+), 12 deletions(-)

diff --git a/madtty.c b/madtty.c @@ -540,13 +540,6 @@ static void interpret_csi_DCH(madtty_t *t, int param[], int pcount) t_row_set(row, t->cols - n, n, t); } -/* Interpret a 'scroll reverse' (SR) */ -static void interpret_csi_SR(madtty_t *t) -{ - t_row_roll(t->scroll_top, t->scroll_bot, -1); - t_row_set(t->scroll_top, 0, t->cols, t); -} - /* Interpret an 'insert line' sequence (IL) */ static void interpret_csi_IL(madtty_t *t, int param[], int pcount) { @@ -725,6 +718,29 @@ static void es_interpret_csi(madtty_t *t) } } +/* Interpret an 'index' (IND) sequence */ +static void interpret_esc_IND(madtty_t *t) +{ + if (t->curs_row < t->lines + t->rows - 1) + t->curs_row++; +} + +/* Interpret a 'reverse index' (RI) sequence */ +static void interpret_esc_RI(madtty_t *t) +{ + if (t->curs_row > t->lines) + t->curs_row--; +} + +/* Interpret a 'next line' (NEL) sequence */ +static void interpret_esc_NEL(madtty_t *t) +{ + if (t->curs_row < t->lines + t->rows - 1) { + t->curs_row++; + t->curs_col = 0; + } +} + static void interpret_char_set(madtty_t *t) { if (*t->ebuf == '(') { @@ -758,11 +774,6 @@ static void try_interpret_escape_seq(madtty_t *t) } switch (*t->ebuf) { - case 'M': - interpret_csi_SR(t); - cancel_escape_sequence(t); - return; - case '(': case ')': case '#': @@ -798,6 +809,21 @@ static void try_interpret_escape_seq(madtty_t *t) cancel_escape_sequence(t); return; + case 'D': /* IND: index */ + interpret_esc_IND(t); + cancel_escape_sequence(t); + return; + + case 'M': /* RI: reverse index */ + interpret_esc_RI(t); + cancel_escape_sequence(t); + return; + + case 'E': /* NEL: next line */ + interpret_esc_NEL(t); + cancel_escape_sequence(t); + return; + default: goto cancel; }