X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=b7dfd559ab211369fa866304735910f225ae8170;hb=c084c06b402de4fe995734a2c89cae26ff7c9064;hp=d169ddfe592cd3ec7fe2a04bf034549bea9a679d;hpb=ee7fd748ac7bfabda2ac37251d230b45adb3e138;p=st.git diff --git a/st.c b/st.c index d169ddf..b7dfd55 100644 --- a/st.c +++ b/st.c @@ -1203,6 +1203,18 @@ csihandle(void) { DEFAULT(escseq.arg[0], 1); tmoveto(0, term.c.y-escseq.arg[0]); break; + case 'g': /* TBC -- Tabulation clear */ + switch (escseq.arg[0]) { + case 0: /* clear current tab stop */ + term.tabs[term.c.x] = 0; + break; + case 3: /* clear all the tabs */ + memset(term.tabs, 0, term.col * sizeof(*term.tabs)); + break; + default: + goto unknown; + } + break; case 'G': /* CHA -- Move to */ case '`': /* XXX: HPA -- same? */ DEFAULT(escseq.arg[0], 1); @@ -1214,7 +1226,6 @@ csihandle(void) { DEFAULT(escseq.arg[1], 1); tmoveto(escseq.arg[1]-1, escseq.arg[0]-1); break; - /* XXX: (CSI n I) CHT -- Cursor Forward Tabulation tab stops */ case 'J': /* ED -- Clear screen */ sel.bx = -1; switch(escseq.arg[0]) { @@ -1429,8 +1440,11 @@ csireset(void) { void tputtab(void) { - int space = TAB - term.c.x % TAB; - tmoveto(term.c.x + space, term.c.y); + unsigned x; + + for (x = term.c.x + 1; x < term.col && !term.tabs[x]; ++x) + /* nothing */ ; + tmoveto(x, term.c.y); } void @@ -1491,6 +1505,10 @@ tputc(char *c) { tnewline(1); /* always go to first col */ term.esc = 0; break; + case 'H': /* HTS -- Horizontal tab stop */ + term.tabs[term.c.x] = 1; + term.esc = 0; + break; case 'M': /* RI -- Reverse index */ if(term.c.y == term.top) tscrolldown(term.top, 1);