JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
tab moves the cursor instead of inserting spaces.
[st.git] / st.c
diff --git a/st.c b/st.c
index ef0fd17..c24bb1d 100644 (file)
--- a/st.c
+++ b/st.c
@@ -559,6 +559,17 @@ escreset(void) {
 }
 
 void
+tputtab(void) {
+    int space = TAB - term.c.x % TAB;
+    
+    if(term.c.x + space >= term.col)
+        space--;
+    
+    for(; space > 0; space--)
+        tcursor(CSright);
+}
+
+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;