---
st.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/st.c b/st.c
index f1b2d74..19aa224 100644
--- a/st.c
+++ b/st.c
_AT_@ -115,7 +115,8 @@ enum term_mode {
MODE_MOUSEMOTION = 64,
MODE_MOUSE = 32|64,
MODE_REVERSE = 128,
- MODE_KBDLOCK = 256
+ MODE_KBDLOCK = 256,
+ MODE_ORIGIN = 512
};
enum escape_state {
_AT_@ -300,6 +301,7 @@ static void tdeleteline(int);
static void tinsertblank(int);
static void tinsertblankline(int);
static void tmoveto(int, int);
+static void tmoveato(int x, int y);
static void tnew(int, int);
static void tnewline(int);
static void tputtab(bool);
_AT_@ -1209,10 +1211,25 @@ csiparse(void) {
}
}
+/* for absolute user moves, when decom is set */
+void
+tmoveato(int x, int y) {
+ tmoveto(x, y + ((IS_SET(MODE_ORIGIN)) ? term.top: 0));
+}
+
void
tmoveto(int x, int y) {
+ int miny, maxy;
+
+ if(IS_SET(MODE_ORIGIN)) {
+ miny = term.top;
+ maxy = term.bot;
+ } else {
+ miny = 0;
+ maxy = term.row - 1;
+ }
LIMIT(x, 0, term.col-1);
- LIMIT(y, 0, term.row-1);
+ LIMIT(y, miny, maxy);
term.c.state &= ~CURSOR_WRAPNEXT;
term.c.x = x;
term.c.y = y;
_AT_@ -1454,7 +1471,9 @@ tsetmode(bool priv, bool set, int *args, int narg) {
if(mode != term.mode)
redraw();
break;
- case 6: /* XXX: DECOM -- Origin */
+ case 6: /* DECOM -- Origin */
+ MODBIT(term.mode, set, MODE_ORIGIN);
+ tmoveato(0, 0);
break;
case 7: /* DECAWM -- Auto wrap */
MODBIT(term.mode, set, MODE_WRAP);
_AT_@ -1591,7 +1610,7 @@ csihandle(void) {
case 'f': /* HVP */
DEFAULT(csiescseq.arg[0], 1);
DEFAULT(csiescseq.arg[1], 1);
- tmoveto(csiescseq.arg[1]-1, csiescseq.arg[0]-1);
+ tmoveato(csiescseq.arg[1]-1, csiescseq.arg[0]-1);
break;
case 'I': /* CHT -- Cursor Forward Tabulation <n> tab stops */
DEFAULT(csiescseq.arg[0], 1);
_AT_@ -1665,7 +1684,7 @@ csihandle(void) {
break;
case 'd': /* VPA -- Move to <row> */
DEFAULT(csiescseq.arg[0], 1);
- tmoveto(term.c.x, csiescseq.arg[0]-1);
+ tmoveato(term.c.x, csiescseq.arg[0]-1);
break;
case 'h': /* SM -- Set terminal mode */
tsetmode(csiescseq.priv, 1, csiescseq.arg, csiescseq.narg);
_AT_@ -1680,7 +1699,7 @@ csihandle(void) {
DEFAULT(csiescseq.arg[0], 1);
DEFAULT(csiescseq.arg[1], term.row);
tsetscroll(csiescseq.arg[0]-1, csiescseq.arg[1]-1);
- tmoveto(0, 0);
+ tmoveato(0, 0);
}
break;
case 's': /* DECSC -- Save cursor position (ANSI.SYS) */
_AT_@ -2117,9 +2136,9 @@ tresize(int col, int row) {
term.col = col;
term.row = row;
/* make use of the LIMIT in tmoveto */
- tmoveto(term.c.x, term.c.y);
/* reset scrolling region */
tsetscroll(0, row-1);
+ tmoveto(term.c.x, term.c.y);
return (slide > 0);
}
--
1.7.10.4
--C7zPtVaVf+AK4Oqc
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment; filename="0003-Fix-VPR-sequence.patch"
Received on Mon Sep 17 2001 - 00:00:00 CEST
This archive was generated by hypermail 2.3.0 : Wed Nov 07 2012 - 19:24:02 CET