Added support for the TABS environment variable. This variable can be used to s… | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 4c7dcf44a81be2d8469cac905563052c90c82375 | |
parent 552fde3f668763fa3256e05261aa88b0bd966388 | |
Author: Rob King <[email protected]> | |
Date: Tue, 4 Aug 2015 18:55:55 -0500 | |
Added support for the TABS environment variable. | |
This variable can be used to set the width of a | |
tab character. | |
Diffstat: | |
doc/sam.1 | 4 ++++ | |
doc/sam.1.pdf | 0 | |
libframe/frinit.c | 7 ++++++- | |
3 files changed, 10 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/doc/sam.1 b/doc/sam.1 | |
@@ -992,6 +992,10 @@ e.g. | |
Any additional arguments should be passed to the command on the remote machine. | |
By default, this is the string | |
.Dq "ssh" "." | |
+.It Ev TABS | |
+A number between 1 and 12, indicating the width of a tab character. | |
+This number is treated as a multiplier of the width of the '0' character. | |
+The default is 8. | |
.El | |
.Sh FILES | |
.Bl -tag -width Ds | |
diff --git a/doc/sam.1.pdf b/doc/sam.1.pdf | |
Binary files differ. | |
diff --git a/libframe/frinit.c b/libframe/frinit.c | |
@@ -7,11 +7,16 @@ | |
void | |
frinit(Frame *f, Rectangle r, XftFont *ft, Bitmap *b) | |
{ | |
+ int tabwidth = 8; | |
+ int tabs = atoi(getenv("TABS") ? getenv("TABS") : ""); | |
+ if (tabs > 0 && tabs < 12) | |
+ tabwidth = tabs; | |
+ | |
f->font = ft; | |
/* ft->height is NOT CORRECT; we must use ascent + descent to | |
clear the lowest edge of characters. - cks */ | |
f->fheight = ft->ascent + ft->descent; | |
- f->maxtab = 8*charwidth(ft, '0'); | |
+ f->maxtab = tabwidth*charwidth(ft, '0'); | |
f->nbox = 0; | |
f->nalloc = 0; | |
f->nchars = 0; |