mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-21 23:05:59 +01: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 tnew(int, int);
|
||||
static void tnewline(int);
|
||||
static void tputtab(void);
|
||||
static void tputtab(bool);
|
||||
static void tputc(char*);
|
||||
static void treset(void);
|
||||
static int tresize(int, int);
|
||||
|
@ -1243,7 +1243,7 @@ csihandle(void) {
|
|||
case 'I': /* CHT -- Cursor Forward Tabulation <n> tab stops */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
while (csiescseq.arg[0]--)
|
||||
tputtab();
|
||||
tputtab(1);
|
||||
break;
|
||||
case 'J': /* ED -- Clear screen */
|
||||
sel.bx = -1;
|
||||
|
@ -1356,7 +1356,11 @@ csihandle(void) {
|
|||
DEFAULT(csiescseq.arg[0], 1);
|
||||
tdeletechar(csiescseq.arg[0]);
|
||||
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> */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
tmoveto(term.c.x, csiescseq.arg[0]-1);
|
||||
|
@ -1528,11 +1532,20 @@ strreset(void) {
|
|||
}
|
||||
|
||||
void
|
||||
tputtab(void) {
|
||||
unsigned x;
|
||||
tputtab(bool forward) {
|
||||
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 */ ;
|
||||
} else {
|
||||
if (x == 0)
|
||||
return;
|
||||
for (--x; x > 0 && !term.tabs[x]; --x)
|
||||
/* nothing */ ;
|
||||
}
|
||||
tmoveto(x, term.c.y);
|
||||
}
|
||||
|
||||
|
@ -1650,7 +1663,7 @@ tputc(char *c) {
|
|||
sel.bx = -1;
|
||||
switch(ascii) {
|
||||
case '\t':
|
||||
tputtab();
|
||||
tputtab(1);
|
||||
break;
|
||||
case '\b':
|
||||
tmoveto(term.c.x-1, term.c.y);
|
||||
|
|
Loading…
Reference in a new issue