handle tabulation (still not perfect) - st - Personal fork of st
 (HTM) git clone git://git.drkhsh.at/st.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 1cf8b77d2798a43c979b71e16fd45d63b808f569
 (DIR) parent 0ecfcc39b07bb7cca6a688a743299e6ef990e122
 (HTM) Author: Aurélien Aptel <aurelien.aptel@gmail.com>
       Date:   Thu, 14 May 2009 01:03:17 +0200
       
       handle tabulation (still not perfect)
       
       Diffstat:
         M st.c                                |      14 ++++++++++++++
         M st.h                                |       2 ++
       
       2 files changed, 16 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git 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--)
       +        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;
 (DIR) diff --git 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 */