[hackers] [st] handle tabulation (still not perfect) || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Wed, 13 May 2009 23:03:26 +0000 (UTC)

changeset: 50:cb345f153662
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Thu May 14 01:03:17 2009 +0200
files: st.c st.h
description:
handle tabulation (still not perfect)

diff -r 7409057d7df7 -r cb345f153662 st.c
--- a/st.c Thu May 14 00:28:10 2009 +0200
+++ b/st.c Thu May 14 01:03:17 2009 +0200
@@ -559,6 +559,17 @@
 }
 
 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 @@
                         tsetchar(c);
                         tcursor(CSright);
                         break;
+ case '\t':
+ tputtab();
+ break;
                 case '\b':
                         tcursor(CSleft);
                         break;
diff -r 7409057d7df7 -r cb345f153662 st.h
--- a/st.h Thu May 14 00:28:10 2009 +0200
+++ b/st.h Thu May 14 01:03:17 2009 +0200
@@ -66,6 +66,8 @@
 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 */
Received on Wed May 13 2009 - 23:03:26 UTC

This archive was generated by hypermail 2.2.0 : Wed May 13 2009 - 23:12:02 UTC