]> git.armaanb.net Git - st.git/commitdiff
handle tabulation (still not perfect)
authorAurélien Aptel <aurelien.aptel@gmail.com>
Wed, 13 May 2009 23:03:17 +0000 (01:03 +0200)
committerAurélien Aptel <aurelien.aptel@gmail.com>
Wed, 13 May 2009 23:03:17 +0000 (01:03 +0200)
st.c
st.h

diff --git a/st.c b/st.c
index ef0fd17d00eaa7ea057fb7bb88093b4ed937f9a6..79fb16101a8831597694e88d104242e33045062d 100644 (file)
--- a/st.c
+++ b/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;
diff --git a/st.h b/st.h
index 87db5c218ddb83d19a9cd9c7477421e6d5db2b54..4652a333fb3bbefa1a232cf77d3b8df5f759ce1b 100644 (file)
--- a/st.h
+++ b/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 */