version 1.45, 2023/03/08 04:43:11 |
version 1.46, 2023/04/17 09:49:04 |
|
|
|
|
for (i = 0; i < wp->w_doto; ++i) { |
for (i = 0; i < wp->w_doto; ++i) { |
c = lgetc(wp->w_dotp, i); |
c = lgetc(wp->w_dotp, i); |
if (c == '\t' |
if (c == '\t') { |
#ifdef NOTAB |
|
&& !(wp->w_bufp->b_flag & BFNOTAB) |
|
#endif /* NOTAB */ |
|
) { |
|
col |= 0x07; |
col |= 0x07; |
col++; |
col++; |
} else if (ISCTRL(c) != FALSE) |
} else if (ISCTRL(c) != FALSE) |
|
|
return (TRUE); |
return (TRUE); |
} |
} |
|
|
|
/* |
|
* Raw indent routine. Use spaces and tabs to fill the given number of |
|
* cols, but respect no-tab-mode. |
|
*/ |
|
int |
|
doindent(int cols) |
|
{ |
|
int n; |
|
|
|
if (curbp->b_flag & BFNOTAB) |
|
return (linsert(cols, ' ')); |
|
if ((n = cols / 8) != 0 && linsert(n, '\t') == FALSE) |
|
return (FALSE); |
|
if ((n = cols % 8) != 0 && linsert(n, ' ') == FALSE) |
|
return (FALSE); |
|
return (TRUE); |
|
} |
|
|
/* |
/* |
* Insert a newline, then enough tabs and spaces to duplicate the indentation |
* Insert a newline, then enough tabs and spaces to duplicate the indentation |
|
|
++nicol; |
++nicol; |
} |
} |
(void)delwhite(FFRAND, 1); |
(void)delwhite(FFRAND, 1); |
if (lnewline() == FALSE || (( |
|
#ifdef NOTAB |
if (lnewline() == FALSE || doindent(nicol) == FALSE) { |
curbp->b_flag & BFNOTAB) ? linsert(nicol, ' ') == FALSE : ( |
|
#endif /* NOTAB */ |
|
((i = nicol / 8) != 0 && linsert(i, '\t') == FALSE) || |
|
((i = nicol % 8) != 0 && linsert(i, ' ') == FALSE)))) { |
|
s = FALSE; |
s = FALSE; |
break; |
break; |
} |
} |
|
|
int |
int |
indent(int f, int n) |
indent(int f, int n) |
{ |
{ |
int soff, i; |
int soff; |
|
|
if (n < 0) |
if (n < 0) |
return (FALSE); |
return (FALSE); |
|
|
/* insert appropriate whitespace */ |
/* insert appropriate whitespace */ |
soff = curwp->w_doto; |
soff = curwp->w_doto; |
(void)gotobol(FFRAND, 1); |
(void)gotobol(FFRAND, 1); |
if ( |
if (doindent(n) == FALSE) |
#ifdef NOTAB |
|
(curbp->b_flag & BFNOTAB) ? linsert(n, ' ') == FALSE : |
|
#endif /* NOTAB */ |
|
(((i = n / 8) != 0 && linsert(i, '\t') == FALSE) || |
|
((i = n % 8) != 0 && linsert(i, ' ') == FALSE))) |
|
return (FALSE); |
return (FALSE); |
|
|
forwchar(FFRAND, soff); |
forwchar(FFRAND, soff); |
|
|
return (s); |
return (s); |
} |
} |
|
|
#ifdef NOTAB |
|
int |
int |
space_to_tabstop(int f, int n) |
space_to_tabstop(int f, int n) |
{ |
{ |
|
|
return (TRUE); |
return (TRUE); |
return (linsert((n << 3) - (curwp->w_doto & 7), ' ')); |
return (linsert((n << 3) - (curwp->w_doto & 7), ' ')); |
} |
} |
#endif /* NOTAB */ |
|
|
|
/* |
/* |
* Move the dot to the first non-whitespace character of the current line. |
* Move the dot to the first non-whitespace character of the current line. |