diff options
author | rsc <devnull@localhost> | 2004-04-25 20:50:09 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-04-25 20:50:09 +0000 |
commit | fb5ca0b97b372e8cf6261ea7ba70ecc66987b980 (patch) | |
tree | f04685cbc0bb08ddb1488f31e491b740c845a216 /src/cmd | |
parent | 2d930d45526d0f7d452d4f13933dd205f42a90e8 (diff) | |
download | plan9port-fb5ca0b97b372e8cf6261ea7ba70ecc66987b980.tar.gz plan9port-fb5ca0b97b372e8cf6261ea7ba70ecc66987b980.tar.bz2 plan9port-fb5ca0b97b372e8cf6261ea7ba70ecc66987b980.zip |
fix some bugs when using 9term
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/draw/mc.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/cmd/draw/mc.c b/src/cmd/draw/mc.c index d1071fee..cc66707c 100644 --- a/src/cmd/draw/mc.c +++ b/src/cmd/draw/mc.c @@ -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 */ @@ -227,7 +227,7 @@ nexttab(int col) col -= col%tabwid; return col; } - return (col|(TAB-1))+1; + return col+1; } void @@ -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; } |