Added support for the TABS environment variable. This variable can be used to set the width of a tab character. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 4c7dcf44a81be2d8469cac905563052c90c82375
(DIR) parent 552fde3f668763fa3256e05261aa88b0bd966388
(HTM) Author: Rob King <jking@deadpixi.com>
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(-)
---
(DIR) 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
(DIR) diff --git a/doc/sam.1.pdf b/doc/sam.1.pdf
Binary files differ.
(DIR) 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;