mirror of
https://github.com/alrayyes/st.git
synced 2024-11-26 04:46:22 +00:00
Applying the CBT patch of Roberto Vargas. Thanks.
This commit is contained in:
parent
91fa81dbac
commit
c58950f2ef
1 changed files with 36 additions and 23 deletions
27
st.c
27
st.c
|
@ -262,7 +262,7 @@ static void tinsertblankline(int);
|
||||||
static void tmoveto(int, int);
|
static void tmoveto(int, int);
|
||||||
static void tnew(int, int);
|
static void tnew(int, int);
|
||||||
static void tnewline(int);
|
static void tnewline(int);
|
||||||
static void tputtab(void);
|
static void tputtab(bool);
|
||||||
static void tputc(char*);
|
static void tputc(char*);
|
||||||
static void treset(void);
|
static void treset(void);
|
||||||
static int tresize(int, int);
|
static int tresize(int, int);
|
||||||
|
@ -1243,7 +1243,7 @@ csihandle(void) {
|
||||||
case 'I': /* CHT -- Cursor Forward Tabulation <n> tab stops */
|
case 'I': /* CHT -- Cursor Forward Tabulation <n> tab stops */
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
while (csiescseq.arg[0]--)
|
while (csiescseq.arg[0]--)
|
||||||
tputtab();
|
tputtab(1);
|
||||||
break;
|
break;
|
||||||
case 'J': /* ED -- Clear screen */
|
case 'J': /* ED -- Clear screen */
|
||||||
sel.bx = -1;
|
sel.bx = -1;
|
||||||
|
@ -1356,7 +1356,11 @@ csihandle(void) {
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
tdeletechar(csiescseq.arg[0]);
|
tdeletechar(csiescseq.arg[0]);
|
||||||
break;
|
break;
|
||||||
/* XXX: (CSI n Z) CBT -- Cursor Backward Tabulation <n> tab stops */
|
case 'Z': /* CBT -- Cursor Backward Tabulation <n> tab stops */
|
||||||
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
|
while (csiescseq.arg[0]--)
|
||||||
|
tputtab(0);
|
||||||
|
break;
|
||||||
case 'd': /* VPA -- Move to <row> */
|
case 'd': /* VPA -- Move to <row> */
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
tmoveto(term.c.x, csiescseq.arg[0]-1);
|
tmoveto(term.c.x, csiescseq.arg[0]-1);
|
||||||
|
@ -1528,11 +1532,20 @@ strreset(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tputtab(void) {
|
tputtab(bool forward) {
|
||||||
unsigned x;
|
unsigned x = term.c.x;
|
||||||
|
|
||||||
for (x = term.c.x + 1; x < term.col && !term.tabs[x]; ++x)
|
if (forward) {
|
||||||
|
if (x == term.col)
|
||||||
|
return;
|
||||||
|
for (++x; x < term.col && !term.tabs[x]; ++x)
|
||||||
/* nothing */ ;
|
/* nothing */ ;
|
||||||
|
} else {
|
||||||
|
if (x == 0)
|
||||||
|
return;
|
||||||
|
for (--x; x > 0 && !term.tabs[x]; --x)
|
||||||
|
/* nothing */ ;
|
||||||
|
}
|
||||||
tmoveto(x, term.c.y);
|
tmoveto(x, term.c.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1650,7 +1663,7 @@ tputc(char *c) {
|
||||||
sel.bx = -1;
|
sel.bx = -1;
|
||||||
switch(ascii) {
|
switch(ascii) {
|
||||||
case '\t':
|
case '\t':
|
||||||
tputtab();
|
tputtab(1);
|
||||||
break;
|
break;
|
||||||
case '\b':
|
case '\b':
|
||||||
tmoveto(term.c.x-1, term.c.y);
|
tmoveto(term.c.x-1, term.c.y);
|
||||||
|
|
Loading…
Reference in a new issue