Allow enabling of tab expansion via the TABS environment variable. - sam - An u… | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 1dd8035b1ece549eff2a6b57a5ae2a6aebcb2441 | |
parent 5fc6fa96da153d7df639c9c01a398fd146b8c857 | |
Author: Rob King <[email protected]> | |
Date: Thu, 28 Jul 2016 10:15:21 -0500 | |
Allow enabling of tab expansion via the TABS environment variable. | |
Diffstat: | |
doc/sam.1 | 10 ++++++++++ | |
libframe/frinit.c | 6 ++++++ | |
2 files changed, 16 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/doc/sam.1 b/doc/sam.1 | |
@@ -1047,6 +1047,16 @@ By default, this is the string | |
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. | |
+.Pp | |
+If the number specified for | |
+.Ev TABS | |
+is negative, the absolute value of that number is used and automatic tab expan… | |
+.Po | |
+as for the | |
+.Fl e | |
+flag | |
+.Pc | |
+is enabled. | |
.El | |
.Sh FILES | |
.Bl -tag -width Ds | |
diff --git a/libframe/frinit.c b/libframe/frinit.c | |
@@ -5,11 +5,17 @@ | |
#include <frame.h> | |
int tabwidth = 8; | |
+extern int expandtabs; | |
void | |
frinit(Frame *f, Rectangle r, XftFont *ft, Bitmap *b) | |
{ | |
int tabs = atoi(getenv("TABS") ? getenv("TABS") : ""); | |
+ if (tabs < 0){ | |
+ tabs = -tabs; | |
+ expandtabs = 1; | |
+ } | |
+ | |
if (tabs > 0 && tabs <= 12) | |
tabwidth = tabs; | |