diff --git a/Makefile b/Makefile index f1ac67e..bdb6b05 100644 --- a/Makefile +++ b/Makefile @@ -152,8 +152,9 @@ eval.o: eval.c eval.h basic.h bind.h buffer.h crypt.h line.h retcode.h \ exec.o: exec.c exec.h retcode.h buffer.h crypt.h line.h utf8.h bind.h \ display.h estruct.h eval.h file.h flook.h input.h random.h window.h \ defines.h -execute.o: execute.c execute.h estruct.h bind.h random.h display.h file.h \ - buffer.h crypt.h line.h retcode.h utf8.h mlout.h window.h defines.h +execute.o: execute.c execute.h estruct.h bind.h random.h retcode.h \ + display.h file.h buffer.h crypt.h line.h utf8.h mlout.h window.h \ + defines.h file.o: file.c file.h buffer.h crypt.h line.h retcode.h utf8.h defines.h \ display.h estruct.h execute.h fileio.h input.h bind.h lock.h mlout.h \ window.h @@ -178,7 +179,7 @@ names.o: names.c names.h basic.h bind.h bindable.h buffer.h crypt.h \ isearch.h region.h random.h search.h spawn.h window.h defines.h word.h pklock.o: pklock.c estruct.h pklock.h posix.o: posix.c -random.o: random.c random.h basic.h buffer.h crypt.h line.h retcode.h \ +random.o: random.c random.h retcode.h basic.h buffer.h crypt.h line.h \ utf8.h display.h estruct.h execute.h input.h bind.h search.h terminal.h \ defines.h window.h region.o: region.c region.h line.h retcode.h utf8.h buffer.h crypt.h \ diff --git a/eval.c b/eval.c index 036d57f..ba01c9e 100644 --- a/eval.c +++ b/eval.c @@ -129,7 +129,8 @@ static const char *envars[] = { "line", /* text of current line */ "gflags", /* global internal emacs flags */ "rval", /* child process return value */ - "tab", /* tab 4 or 8 */ + "tab", /* tab width, 1... */ + "hardtab", /* TRUE for hard coded tab, FALSE for soft ones */ "overlap", "jump", #if SCROLLCODE @@ -177,9 +178,10 @@ static const char *envars[] = { #define EVGFLAGS 35 #define EVRVAL 36 #define EVTAB 37 -#define EVOVERLAP 38 -#define EVSCROLLCOUNT 39 -#define EVSCROLL 40 +#define EVHARDTAB 38 +#define EVOVERLAP 39 +#define EVSCROLLCOUNT 40 +#define EVSCROLL 41 enum function_type { NILNAMIC = 0, @@ -735,6 +737,8 @@ static char *gtenv( char *vname) { return i_to_a(rval); case EVTAB: return i_to_a( tabwidth) ; + case EVHARDTAB: + return ltos( hardtab) ; case EVOVERLAP: return i_to_a(overlap); case EVSCROLLCOUNT: @@ -1057,6 +1061,9 @@ static int svar(struct variable_description *var, char *value) status = FALSE ; break; + case EVHARDTAB: + hardtab = stol( value) ; + break ; case EVOVERLAP: overlap = atoi(value); break; diff --git a/random.c b/random.c index f1d3709..89a0f51 100644 --- a/random.c +++ b/random.c @@ -40,7 +40,7 @@ static const char *cname[] = { /* names of colors */ int gfcolor = NCOLORS - 1 ; /* global forgrnd color (white) */ int gbcolor = 0 ; /* global backgrnd color (black) */ -static int tabsize ; /* Tab size (0: use real tabs) */ +boolean hardtab = TRUE ; /* use hard tab instead of soft tab */ int fillcol = 72 ; /* Current fill column */ /* uninitialized global definitions */ @@ -292,17 +292,21 @@ int quote(int f, int n) * done in this slightly funny way because the tab (in ASCII) has been turned * into "C-I" (in 10 bit code) already. Bound to "C-I". */ -int insert_tab(int f, int n) -{ - if (n < 0) - return FALSE; - if (n == 0 || n > 1) { - tabsize = n; - return TRUE; - } - if (!tabsize) - return linsert(1, '\t'); - return linsert(tabsize - (getccol(FALSE) % tabsize), ' '); +int insert_tab( int f, int n) { + int status ; + + if( n < 0) + status = FALSE ; + else if( n == 0) + status = TRUE ; + else if( hardtab == TRUE) + status = linsert( n, '\t') ; + else /* softtab */ + do { + status = linsert( tabwidth - getccol( FALSE) % tabwidth, ' ') ; + } while( status != FALSE && --n) ; + + return status ; } #if AEDIT diff --git a/random.h b/random.h index 85fa73a..0830368 100644 --- a/random.h +++ b/random.h @@ -1,9 +1,14 @@ #ifndef _RANDOM_H_ #define _RANDOM_H_ + +#include "retcode.h" + + #define AEDIT 1 extern int fillcol ; /* Fill column */ +extern boolean hardtab ; /* Use hard tab instead of soft tab */ /* Uninitialized global external declarations. */