tfix some bugs when using 9term - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit fb5ca0b97b372e8cf6261ea7ba70ecc66987b980
 (DIR) parent 2d930d45526d0f7d452d4f13933dd205f42a90e8
 (HTM) Author: rsc <devnull@localhost>
       Date:   Sun, 25 Apr 2004 20:50:09 +0000
       
       fix some bugs when using 9term
       
       Diffstat:
         M src/cmd/draw/mc.c                   |      21 +++++++++++++++------
       
       1 file changed, 15 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/draw/mc.c b/src/cmd/draw/mc.c
       t@@ -26,7 +26,7 @@ int wordsize(Rune*, int);
        int nexttab(int);
        
        int tabwid;
       -int mintab;
       +int mintab = 1;
        int linewidth=WIDTH;
        int colonflag=0;
        int tabflag=0;        /* -t flag turned off forever, except in acme */
       t@@ -227,7 +227,7 @@ nexttab(int col)
                        col -= col%tabwid;
                        return col;
                }
       -        return (col|(TAB-1))+1;
       +        return col+1;
        }
        
        void
       t@@ -296,14 +296,23 @@ getwidth(void)
                        return;
                }
        
       +        if((p = getenv("TERM")) != nil && strcmp(p, "9term") == 0)
                if((p = getenv("font")) != nil)
                        font = openfont(nil, p);
       +
                if(windowrect(&ws) < 0)
                        return;
       -        if(ws.ws_ypixel == 0)
       +        if(ws.ws_xpixel == 0)
                        font = nil;
       -        if(font)
       -                linewidth = ws.ws_ypixel;
       -        linewidth = ws.ws_col;
       +        if(font){
       +                mintab = stringwidth(font, "0");
       +                if((p = getenv("tabstop")) != nil)
       +                        tabwid = atoi(p)*mintab;
       +                else
       +                        tabwid = 4*mintab;
       +                tabflag = 1;
       +                linewidth = ws.ws_xpixel;
       +        }else
       +                linewidth = ws.ws_col;
        }