mirror of
https://github.com/rfivet/uemacs.git
synced 2025-02-20 06:57:11 -05:00
Introduce boolean $hardtab to control insertion of hardcoded tab or soft ones (spaces). Review insert_tab accordingly.
This commit is contained in:
parent
8dfa92ba44
commit
3436443807
7
Makefile
7
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 \
|
||||
|
15
eval.c
15
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;
|
||||
|
28
random.c
28
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user