mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-21 23:05:59 +01:00
handle tabulation (still not perfect)
This commit is contained in:
parent
0ecfcc39b0
commit
1cf8b77d27
2 changed files with 16 additions and 0 deletions
14
st.c
14
st.c
|
@ -558,6 +558,17 @@ escreset(void) {
|
|||
memset(&escseq, 0, sizeof(escseq));
|
||||
}
|
||||
|
||||
void
|
||||
tputtab(void) {
|
||||
int space = TAB - term.c.x % TAB;
|
||||
|
||||
if(term.c.x + space >= term.col)
|
||||
space--;
|
||||
|
||||
for(; space > 0; space--)
|
||||
tputc(' ');
|
||||
}
|
||||
|
||||
void
|
||||
tputc(char c) {
|
||||
static int inesc = 0;
|
||||
|
@ -574,6 +585,9 @@ tputc(char c) {
|
|||
tsetchar(c);
|
||||
tcursor(CSright);
|
||||
break;
|
||||
case '\t':
|
||||
tputtab();
|
||||
break;
|
||||
case '\b':
|
||||
tcursor(CSleft);
|
||||
break;
|
||||
|
|
2
st.h
2
st.h
|
@ -66,6 +66,8 @@ enum { CRset=1 , CRupdate=2 }; /* Character state */
|
|||
enum { TMwrap=1 , TMinsert=2 }; /* Terminal mode */
|
||||
enum { SCupdate, SCredraw }; /* screen draw mode */
|
||||
|
||||
typedef int Color;
|
||||
|
||||
typedef struct {
|
||||
char c; /* character code */
|
||||
char mode; /* attribute flags */
|
||||
|
|
Loading…
Reference in a new issue