dvtm

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

commit 81b0904a5c447a799bf831347669c0d65eb54b2a
parent 163a07d5fb99f2b187e1da0f66084f14d6459626
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Fri, 17 Dec 2010 21:20:52 +0100

madtty: add support for relative/absolute mode (ESC[?6h, ESC[?6l)

Based on a patch from Ross Mohn.

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

Diffstat:
madtty.c | 18+++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/madtty.c b/madtty.c @@ -101,6 +101,7 @@ struct madtty_t { unsigned curshid : 1; unsigned curskeymode: 1; unsigned bell : 1; + unsigned relposmode : 1; /* geometry */ int rows, cols, maxcols; @@ -454,15 +455,14 @@ static void interpret_csi_CUP(madtty_t *t, int param[], int pcount) /* special case */ t->curs_row = t->lines; t->curs_col = 0; - return; - } else - if (pcount < 2) { - return; /* malformed */ + } else if (pcount == 1) { + t->curs_row = (t->relposmode ? t->scroll_top : t->lines) + param[0] - 1; + t->curs_col = 0; + } else { + t->curs_row = (t->relposmode ? t->scroll_top : t->lines) + param[0] - 1; + t->curs_col = param[1] - 1; } - t->curs_row = t->lines + param[0] - 1; - t->curs_col = param[1] - 1; - clamp_cursor_to_bounds(t); } @@ -664,6 +664,8 @@ static void es_interpret_csi(madtty_t *t) t->curshid = true; if (csiparam[0] == 1) /* DECCKM: reset ANSI cursor (normal) key mode */ t->curskeymode = 0; + if (csiparam[0] == 6) /* DECOM: set origin to absolute */ + t->relposmode = false; if (csiparam[0] == 47) { /* use normal screen buffer */ t->curattrs = A_NORMAL; @@ -676,6 +678,8 @@ static void es_interpret_csi(madtty_t *t) t->curshid = false; if (csiparam[0] == 1) /* DECCKM: set ANSI cursor (application) key mode */ t->curskeymode = 1; + if (csiparam[0] == 6) /* DECOM: set origin to relative */ + t->relposmode = true; if (csiparam[0] == 47) { /* use alternate screen buffer */ t->curattrs = A_NORMAL;