Replace vim_iswhite with ascii_iswhite() defined in ascii.h

This commit is contained in:
Felipe Oliveira Carvalho 2015-04-22 19:12:26 -03:00
parent d350d12a00
commit 93bf201119
33 changed files with 198 additions and 192 deletions

View File

@ -186,7 +186,7 @@ strcpy() STRCPY() Includes cast to (char *), for char_u * args
strchr() vim_strchr() Accepts special characters strchr() vim_strchr() Accepts special characters
strrchr() vim_strrchr() Accepts special characters strrchr() vim_strrchr() Accepts special characters
isspace() vim_isspace() Can handle characters > 128 isspace() vim_isspace() Can handle characters > 128
iswhite() vim_iswhite() Only TRUE for tab and space iswhite() ascii_iswhite() Only TRUE for tab and space
memcpy() mch_memmove() Handles overlapped copies memcpy() mch_memmove() Handles overlapped copies
bcopy() mch_memmove() Handles overlapped copies bcopy() mch_memmove() Handles overlapped copies
memset() vim_memset() Uniform for all systems memset() vim_memset() Uniform for all systems

View File

@ -8,6 +8,9 @@
#ifndef NVIM_ASCII_H #ifndef NVIM_ASCII_H
#define NVIM_ASCII_H #define NVIM_ASCII_H
#include <stdbool.h>
#include "func_attr.h"
// Definitions of various common control characters. // Definitions of various common control characters.
#define CharOrd(x) ((x) < 'a' ? (x) - 'A' : (x) - 'a') #define CharOrd(x) ((x) < 'a' ? (x) - 'A' : (x) - 'a')
@ -87,4 +90,13 @@
# define PATHSEPSTR "/" # define PATHSEPSTR "/"
#endif #endif
static inline bool ascii_iswhite(int c) FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_CONST;
/// ascii_iswhite() is used for "^" and the like. It differs from isspace()
/// because it doesn't include <CR> and <LF> and the like.
static inline bool ascii_iswhite(int c)
{
return c == ' ' || c == '\t';
}
#endif /* NVIM_ASCII_H */ #endif /* NVIM_ASCII_H */

View File

@ -1407,7 +1407,7 @@ void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left,
char_u* skipwhite(char_u *q) char_u* skipwhite(char_u *q)
{ {
char_u *p = q; char_u *p = q;
while (vim_iswhite(*p)) { while (ascii_iswhite(*p)) {
// skip to next non-white // skip to next non-white
p++; p++;
} }

View File

@ -1590,7 +1590,7 @@ static int diff_cmp(char_u *s1, char_u *s2)
char_u *p2 = s2; char_u *p2 = s2;
while (*p1 != NUL && *p2 != NUL) { while (*p1 != NUL && *p2 != NUL) {
if (vim_iswhite(*p1) && vim_iswhite(*p2)) { if (ascii_iswhite(*p1) && ascii_iswhite(*p2)) {
p1 = skipwhite(p1); p1 = skipwhite(p1);
p2 = skipwhite(p2); p2 = skipwhite(p2);
} else { } else {
@ -1897,8 +1897,8 @@ int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
while (line_org[si_org] != NUL) { while (line_org[si_org] != NUL) {
if ((diff_flags & DIFF_IWHITE) if ((diff_flags & DIFF_IWHITE)
&& vim_iswhite(line_org[si_org]) && ascii_iswhite(line_org[si_org])
&& vim_iswhite(line_new[si_new])) { && ascii_iswhite(line_new[si_new])) {
si_org = (int)(skipwhite(line_org + si_org) - line_org); si_org = (int)(skipwhite(line_org + si_org) - line_org);
si_new = (int)(skipwhite(line_new + si_new) - line_new); si_new = (int)(skipwhite(line_new + si_new) - line_new);
} else { } else {
@ -1931,13 +1931,13 @@ int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
&& ei_org >= 0 && ei_org >= 0
&& ei_new >= 0) { && ei_new >= 0) {
if ((diff_flags & DIFF_IWHITE) if ((diff_flags & DIFF_IWHITE)
&& vim_iswhite(line_org[ei_org]) && ascii_iswhite(line_org[ei_org])
&& vim_iswhite(line_new[ei_new])) { && ascii_iswhite(line_new[ei_new])) {
while (ei_org >= *startp && vim_iswhite(line_org[ei_org])) { while (ei_org >= *startp && ascii_iswhite(line_org[ei_org])) {
ei_org--; ei_org--;
} }
while (ei_new >= si_new && vim_iswhite(line_new[ei_new])) { while (ei_new >= si_new && ascii_iswhite(line_new[ei_new])) {
ei_new--; ei_new--;
} }
} else { } else {
@ -2108,7 +2108,7 @@ void ex_diffgetput(exarg_T *eap)
} else { } else {
// Buffer number or pattern given. Ignore trailing white space. // Buffer number or pattern given. Ignore trailing white space.
p = eap->arg + STRLEN(eap->arg); p = eap->arg + STRLEN(eap->arg);
while (p > eap->arg && vim_iswhite(p[-1])) { while (p > eap->arg && ascii_iswhite(p[-1])) {
p--; p--;
} }

View File

@ -1662,7 +1662,7 @@ void truncate_spaces(char_u *line)
int i; int i;
/* find start of trailing white space */ /* find start of trailing white space */
for (i = (int)STRLEN(line) - 1; i >= 0 && vim_iswhite(line[i]); i--) { for (i = (int)STRLEN(line) - 1; i >= 0 && ascii_iswhite(line[i]); i--) {
if (State & REPLACE_FLAG) if (State & REPLACE_FLAG)
replace_join(0); /* remove a NUL from the replace stack */ replace_join(0); /* remove a NUL from the replace stack */
} }
@ -1838,7 +1838,7 @@ static int ins_compl_accept_char(int c)
case CTRL_X_OMNI: case CTRL_X_OMNI:
/* Command line and Omni completion can work with just about any /* Command line and Omni completion can work with just about any
* printable character, but do stop at white space. */ * printable character, but do stop at white space. */
return vim_isprintc(c) && !vim_iswhite(c); return vim_isprintc(c) && !ascii_iswhite(c);
case CTRL_X_WHOLE_LINE: case CTRL_X_WHOLE_LINE:
/* For while line completion a space can be part of the line. */ /* For while line completion a space can be part of the line. */
@ -4824,7 +4824,7 @@ insert_special (
*/ */
# define ISSPECIAL(c) ((c) < ' ' || (c) >= DEL || (c) == '0' || (c) == '^') # define ISSPECIAL(c) ((c) < ' ' || (c) >= DEL || (c) == '0' || (c) == '^')
# define WHITECHAR(cc) (vim_iswhite(cc) && \ # define WHITECHAR(cc) (ascii_iswhite(cc) && \
(!enc_utf8 || \ (!enc_utf8 || \
!utf_iscomposing( \ !utf_iscomposing( \
utf_ptr2char(get_cursor_pos_ptr() + 1)))) utf_ptr2char(get_cursor_pos_ptr() + 1))))
@ -4870,7 +4870,7 @@ insertchar (
*/ */
if (textwidth > 0 if (textwidth > 0
&& ((flags & INSCHAR_FORMAT) && ((flags & INSCHAR_FORMAT)
|| (!vim_iswhite(c) || (!ascii_iswhite(c)
&& !((State & REPLACE_FLAG) && !((State & REPLACE_FLAG)
&& !(State & VREPLACE_FLAG) && !(State & VREPLACE_FLAG)
&& *get_cursor_pos_ptr() != NUL) && *get_cursor_pos_ptr() != NUL)
@ -4915,7 +4915,7 @@ insertchar (
++p; ++p;
middle_len = copy_option_part(&p, lead_end, COM_MAX_LEN, ","); middle_len = copy_option_part(&p, lead_end, COM_MAX_LEN, ",");
/* Don't count trailing white space for middle_len */ /* Don't count trailing white space for middle_len */
while (middle_len > 0 && vim_iswhite(lead_end[middle_len - 1])) while (middle_len > 0 && ascii_iswhite(lead_end[middle_len - 1]))
--middle_len; --middle_len;
/* Find the end-comment string */ /* Find the end-comment string */
@ -4925,7 +4925,7 @@ insertchar (
/* Skip white space before the cursor */ /* Skip white space before the cursor */
i = curwin->w_cursor.col; i = curwin->w_cursor.col;
while (--i >= 0 && vim_iswhite(line[i])) while (--i >= 0 && ascii_iswhite(line[i]))
; ;
i++; i++;
@ -5071,7 +5071,7 @@ internal_format (
&& !(State & VREPLACE_FLAG) && !(State & VREPLACE_FLAG)
) { ) {
cc = gchar_cursor(); cc = gchar_cursor();
if (vim_iswhite(cc)) { if (ascii_iswhite(cc)) {
save_char = cc; save_char = cc;
pchar_cursor('x'); pchar_cursor('x');
} }
@ -5682,13 +5682,13 @@ stop_insert (
if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL) { if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL) {
dec_cursor(); dec_cursor();
cc = gchar_cursor(); cc = gchar_cursor();
if (!vim_iswhite(cc)) if (!ascii_iswhite(cc))
curwin->w_cursor = tpos; curwin->w_cursor = tpos;
} }
auto_format(TRUE, FALSE); auto_format(TRUE, FALSE);
if (vim_iswhite(cc)) { if (ascii_iswhite(cc)) {
if (gchar_cursor() != NUL) if (gchar_cursor() != NUL)
inc_cursor(); inc_cursor();
/* If the cursor is still at the same character, also keep /* If the cursor is still at the same character, also keep
@ -5720,7 +5720,7 @@ stop_insert (
if (gchar_cursor() == NUL && curwin->w_cursor.col > 0) if (gchar_cursor() == NUL && curwin->w_cursor.col > 0)
--curwin->w_cursor.col; --curwin->w_cursor.col;
cc = gchar_cursor(); cc = gchar_cursor();
if (!vim_iswhite(cc)) if (!ascii_iswhite(cc))
break; break;
if (del_char(TRUE) == FAIL) if (del_char(TRUE) == FAIL)
break; /* should not happen */ break; /* should not happen */
@ -5836,7 +5836,7 @@ void beginline(int flags)
if (flags & (BL_WHITE | BL_SOL)) { if (flags & (BL_WHITE | BL_SOL)) {
char_u *ptr; char_u *ptr;
for (ptr = get_cursor_line_ptr(); vim_iswhite(*ptr) for (ptr = get_cursor_line_ptr(); ascii_iswhite(*ptr)
&& !((flags & BL_FIX) && ptr[1] == NUL); ++ptr) && !((flags & BL_FIX) && ptr[1] == NUL); ++ptr)
++curwin->w_cursor.col; ++curwin->w_cursor.col;
} }
@ -7369,7 +7369,7 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
/* delete characters until we are at or before want_vcol */ /* delete characters until we are at or before want_vcol */
while (vcol > want_vcol while (vcol > want_vcol
&& (cc = *(get_cursor_pos_ptr() - 1), vim_iswhite(cc))) && (cc = *(get_cursor_pos_ptr() - 1), ascii_iswhite(cc)))
ins_bs_one(&vcol); ins_bs_one(&vcol);
/* insert extra spaces until we are at want_vcol */ /* insert extra spaces until we are at want_vcol */
@ -7882,7 +7882,7 @@ static int ins_tab(void)
/* Find first white before the cursor */ /* Find first white before the cursor */
fpos = curwin->w_cursor; fpos = curwin->w_cursor;
while (fpos.col > 0 && vim_iswhite(ptr[-1])) { while (fpos.col > 0 && ascii_iswhite(ptr[-1])) {
--fpos.col; --fpos.col;
--ptr; --ptr;
} }
@ -7901,7 +7901,7 @@ static int ins_tab(void)
/* Use as many TABs as possible. Beware of 'breakindent', 'showbreak' /* Use as many TABs as possible. Beware of 'breakindent', 'showbreak'
and 'linebreak' adding extra virtual columns. */ and 'linebreak' adding extra virtual columns. */
while (vim_iswhite(*ptr)) { while (ascii_iswhite(*ptr)) {
i = lbr_chartabsize(NULL, (char_u *)"\t", vcol); i = lbr_chartabsize(NULL, (char_u *)"\t", vcol);
if (vcol + i > want_vcol) if (vcol + i > want_vcol)
break; break;
@ -8201,7 +8201,7 @@ static void ins_try_si(int c)
ptr = ml_get(pos->lnum); ptr = ml_get(pos->lnum);
i = pos->col; i = pos->col;
if (i > 0) /* skip blanks before '{' */ if (i > 0) /* skip blanks before '{' */
while (--i > 0 && vim_iswhite(ptr[i])) while (--i > 0 && ascii_iswhite(ptr[i]))
; ;
curwin->w_cursor.lnum = pos->lnum; curwin->w_cursor.lnum = pos->lnum;
curwin->w_cursor.col = i; curwin->w_cursor.col = i;

View File

@ -1636,7 +1636,7 @@ static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first)
while (!ends_excmd(*arg) && !got_int) { while (!ends_excmd(*arg) && !got_int) {
if (error || eap->skip) { if (error || eap->skip) {
arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START); arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
if (!vim_iswhite(*arg) && !ends_excmd(*arg)) { if (!ascii_iswhite(*arg) && !ends_excmd(*arg)) {
emsg_severe = TRUE; emsg_severe = TRUE;
EMSG(_(e_trailing)); EMSG(_(e_trailing));
break; break;
@ -1943,7 +1943,7 @@ get_lval (
p = find_name_end(name, &expr_start, &expr_end, fne_flags); p = find_name_end(name, &expr_start, &expr_end, fne_flags);
if (expr_start != NULL) { if (expr_start != NULL) {
/* Don't expand the name when we already know there is an error. */ /* Don't expand the name when we already know there is an error. */
if (unlet && !vim_iswhite(*p) && !ends_excmd(*p) if (unlet && !ascii_iswhite(*p) && !ends_excmd(*p)
&& *p != '[' && *p != '.') { && *p != '[' && *p != '.') {
EMSG(_(e_trailing)); EMSG(_(e_trailing));
return NULL; return NULL;
@ -2476,7 +2476,7 @@ void *eval_for_line(char_u *arg, int *errp, char_u **nextcmdp, int skip)
return fi; return fi;
expr = skipwhite(expr); expr = skipwhite(expr);
if (expr[0] != 'i' || expr[1] != 'n' || !vim_iswhite(expr[2])) { if (expr[0] != 'i' || expr[1] != 'n' || !ascii_iswhite(expr[2])) {
EMSG(_("E690: Missing \"in\" after :for")); EMSG(_("E690: Missing \"in\" after :for"));
return fi; return fi;
} }
@ -2556,7 +2556,7 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
for (p = arg + STRLEN(arg); p >= arg; ) { for (p = arg + STRLEN(arg); p >= arg; ) {
xp->xp_pattern = p; xp->xp_pattern = p;
mb_ptr_back(arg, p); mb_ptr_back(arg, p);
if (vim_iswhite(*p)) if (ascii_iswhite(*p))
break; break;
} }
return; return;
@ -2778,7 +2778,7 @@ static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep)
FNE_CHECK_START); FNE_CHECK_START);
if (lv.ll_name == NULL) if (lv.ll_name == NULL)
error = TRUE; /* error but continue parsing */ error = TRUE; /* error but continue parsing */
if (name_end == NULL || (!vim_iswhite(*name_end) if (name_end == NULL || (!ascii_iswhite(*name_end)
&& !ends_excmd(*name_end))) { && !ends_excmd(*name_end))) {
if (name_end != NULL) { if (name_end != NULL) {
emsg_severe = TRUE; emsg_severe = TRUE;
@ -16502,7 +16502,7 @@ handle_subscript (
&& (**arg == '[' && (**arg == '['
|| (**arg == '.' && rettv->v_type == VAR_DICT) || (**arg == '.' && rettv->v_type == VAR_DICT)
|| (**arg == '(' && (!evaluate || rettv->v_type == VAR_FUNC))) || (**arg == '(' && (!evaluate || rettv->v_type == VAR_FUNC)))
&& !vim_iswhite(*(*arg - 1))) { && !ascii_iswhite(*(*arg - 1))) {
if (**arg == '(') { if (**arg == '(') {
/* need to copy the funcref so that we can clear rettv */ /* need to copy the funcref so that we can clear rettv */
if (evaluate) { if (evaluate) {
@ -17929,7 +17929,7 @@ void ex_function(exarg_T *eap)
} }
} else { } else {
/* skip ':' and blanks*/ /* skip ':' and blanks*/
for (p = theline; vim_iswhite(*p) || *p == ':'; ++p) for (p = theline; ascii_iswhite(*p) || *p == ':'; ++p)
; ;
/* Check for "endfunction". */ /* Check for "endfunction". */

View File

@ -266,7 +266,7 @@ static int linelen(int *has_tab)
/* find the character after the last non-blank character */ /* find the character after the last non-blank character */
for (last = first + STRLEN(first); for (last = first + STRLEN(first);
last > first && vim_iswhite(last[-1]); --last) last > first && ascii_iswhite(last[-1]); --last)
; ;
save = *last; save = *last;
*last = NUL; *last = NUL;
@ -374,7 +374,7 @@ void ex_sort(exarg_T *eap)
sort_abort = sort_ic = sort_rx = sort_nr = sort_oct = sort_hex = 0; sort_abort = sort_ic = sort_rx = sort_nr = sort_oct = sort_hex = 0;
for (p = eap->arg; *p != NUL; ++p) { for (p = eap->arg; *p != NUL; ++p) {
if (vim_iswhite(*p)) if (ascii_iswhite(*p))
; ;
else if (*p == 'i') else if (*p == 'i')
sort_ic = TRUE; sort_ic = TRUE;
@ -581,7 +581,7 @@ void ex_retab(exarg_T *eap)
vcol = 0; vcol = 0;
did_undo = FALSE; did_undo = FALSE;
for (;; ) { for (;; ) {
if (vim_iswhite(ptr[col])) { if (ascii_iswhite(ptr[col])) {
if (!got_tab && num_spaces == 0) { if (!got_tab && num_spaces == 0) {
/* First consecutive white-space */ /* First consecutive white-space */
start_vcol = vcol; start_vcol = vcol;
@ -3422,7 +3422,7 @@ void do_sub(exarg_T *eap)
which_pat = RE_SUBST; /* use last substitute regexp */ which_pat = RE_SUBST; /* use last substitute regexp */
/* new pattern and substitution */ /* new pattern and substitution */
if (eap->cmd[0] == 's' && *cmd != NUL && !vim_iswhite(*cmd) if (eap->cmd[0] == 's' && *cmd != NUL && !ascii_iswhite(*cmd)
&& vim_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL) { && vim_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL) {
/* don't accept alphanumeric for separator */ /* don't accept alphanumeric for separator */
if (isalpha(*cmd)) { if (isalpha(*cmd)) {
@ -4622,7 +4622,7 @@ void ex_help(exarg_T *eap)
/* remove trailing blanks */ /* remove trailing blanks */
p = arg + STRLEN(arg) - 1; p = arg + STRLEN(arg) - 1;
while (p > arg && vim_iswhite(*p) && p[-1] != '\\') while (p > arg && ascii_iswhite(*p) && p[-1] != '\\')
*p-- = NUL; *p-- = NUL;
/* Check for a specified language */ /* Check for a specified language */
@ -5069,7 +5069,7 @@ void fix_help_buffer(void)
for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) { for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) {
line = ml_get_buf(curbuf, lnum, FALSE); line = ml_get_buf(curbuf, lnum, FALSE);
len = (int)STRLEN(line); len = (int)STRLEN(line);
if (in_example && len > 0 && !vim_iswhite(line[0])) { if (in_example && len > 0 && !ascii_iswhite(line[0])) {
/* End of example: non-white or '<' in first column. */ /* End of example: non-white or '<' in first column. */
if (line[0] == '<') { if (line[0] == '<') {
/* blank-out a '<' in the first column */ /* blank-out a '<' in the first column */
@ -5281,7 +5281,7 @@ void ex_helptags(exarg_T *eap)
int add_help_tags = FALSE; int add_help_tags = FALSE;
/* Check for ":helptags ++t {dir}". */ /* Check for ":helptags ++t {dir}". */
if (STRNCMP(eap->arg, "++t", 3) == 0 && vim_iswhite(eap->arg[3])) { if (STRNCMP(eap->arg, "++t", 3) == 0 && ascii_iswhite(eap->arg[3])) {
add_help_tags = TRUE; add_help_tags = TRUE;
eap->arg = skipwhite(eap->arg + 3); eap->arg = skipwhite(eap->arg + 3);
} }
@ -5870,7 +5870,7 @@ void ex_sign(exarg_T *eap)
if (VIM_ISDIGIT(*arg)) if (VIM_ISDIGIT(*arg))
{ {
id = getdigits_int(&arg); id = getdigits_int(&arg);
if (!vim_iswhite(*arg) && *arg != NUL) if (!ascii_iswhite(*arg) && *arg != NUL)
{ {
id = -1; id = -1;
arg = arg1; arg = arg1;

View File

@ -3091,7 +3091,7 @@ void ex_language(exarg_T *eap)
* Allow abbreviation, but require at least 3 characters to avoid * Allow abbreviation, but require at least 3 characters to avoid
* confusion with a two letter language name "me" or "ct". */ * confusion with a two letter language name "me" or "ct". */
p = skiptowhite(eap->arg); p = skiptowhite(eap->arg);
if ((*p == NUL || vim_iswhite(*p)) && p - eap->arg >= 3) { if ((*p == NUL || ascii_iswhite(*p)) && p - eap->arg >= 3) {
if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) { if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) {
what = VIM_LC_MESSAGES; what = VIM_LC_MESSAGES;
name = skipwhite(p); name = skipwhite(p);

View File

@ -1251,7 +1251,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
if (save_msg_silent == -1) if (save_msg_silent == -1)
save_msg_silent = msg_silent; save_msg_silent = msg_silent;
++msg_silent; ++msg_silent;
if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1])) { if (*ea.cmd == '!' && !ascii_iswhite(ea.cmd[-1])) {
/* ":silent!", but not "silent !cmd" */ /* ":silent!", but not "silent !cmd" */
ea.cmd = skipwhite(ea.cmd + 1); ea.cmd = skipwhite(ea.cmd + 1);
++emsg_silent; ++emsg_silent;
@ -1722,7 +1722,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
*/ */
if ((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg) if ((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg)
&& (!(ea.argt & BUFNAME) || *(p = skipdigits(ea.arg)) == NUL && (!(ea.argt & BUFNAME) || *(p = skipdigits(ea.arg)) == NUL
|| vim_iswhite(*p))) { || ascii_iswhite(*p))) {
n = getdigits_long(&ea.arg); n = getdigits_long(&ea.arg);
ea.arg = skipwhite(ea.arg); ea.arg = skipwhite(ea.arg);
if (n <= 0 && !ni && (ea.argt & ZEROR) == 0) { if (n <= 0 && !ni && (ea.argt & ZEROR) == 0) {
@ -1875,7 +1875,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
p = skiptowhite_esc(ea.arg); p = skiptowhite_esc(ea.arg);
else { else {
p = ea.arg + STRLEN(ea.arg); p = ea.arg + STRLEN(ea.arg);
while (p > ea.arg && vim_iswhite(p[-1])) while (p > ea.arg && ascii_iswhite(p[-1]))
--p; --p;
} }
ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & BUFUNL) != 0, ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & BUFUNL) != 0,
@ -2577,7 +2577,7 @@ set_one_cmd_context (
else if (c == '|' else if (c == '|'
|| c == '\n' || c == '\n'
|| c == '"' || c == '"'
|| vim_iswhite(c)) { || ascii_iswhite(c)) {
len = 0; /* avoid getting stuck when space is in 'isfname' */ len = 0; /* avoid getting stuck when space is in 'isfname' */
while (*p != NUL) { while (*p != NUL) {
if (has_mbyte) if (has_mbyte)
@ -3563,7 +3563,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
/* skip escaped characters */ /* skip escaped characters */
if (p[1] && (*p == '\\' || *p == Ctrl_V)) if (p[1] && (*p == '\\' || *p == Ctrl_V))
++p; ++p;
else if (vim_iswhite(*p)) { else if (ascii_iswhite(*p)) {
*errormsgp = (char_u *)_("E172: Only one file name allowed"); *errormsgp = (char_u *)_("E172: Only one file name allowed");
return FAIL; return FAIL;
} }
@ -4494,7 +4494,7 @@ static void ex_command(exarg_T *eap)
if (ASCII_ISALPHA(*p)) if (ASCII_ISALPHA(*p))
while (ASCII_ISALNUM(*p)) while (ASCII_ISALNUM(*p))
++p; ++p;
if (!ends_excmd(*p) && !vim_iswhite(*p)) { if (!ends_excmd(*p) && !ascii_iswhite(*p)) {
EMSG(_("E182: Invalid command name")); EMSG(_("E182: Invalid command name"));
return; return;
} }
@ -4597,13 +4597,13 @@ static char_u *uc_split_args(char_u *arg, size_t *lenp)
if (p[0] == '\\' && p[1] == '\\') { if (p[0] == '\\' && p[1] == '\\') {
len += 2; len += 2;
p += 2; p += 2;
} else if (p[0] == '\\' && vim_iswhite(p[1])) { } else if (p[0] == '\\' && ascii_iswhite(p[1])) {
len += 1; len += 1;
p += 2; p += 2;
} else if (*p == '\\' || *p == '"') { } else if (*p == '\\' || *p == '"') {
len += 2; len += 2;
p += 1; p += 1;
} else if (vim_iswhite(*p)) { } else if (ascii_iswhite(*p)) {
p = skipwhite(p); p = skipwhite(p);
if (*p == NUL) if (*p == NUL)
break; break;
@ -4625,13 +4625,13 @@ static char_u *uc_split_args(char_u *arg, size_t *lenp)
*q++ = '\\'; *q++ = '\\';
*q++ = '\\'; *q++ = '\\';
p += 2; p += 2;
} else if (p[0] == '\\' && vim_iswhite(p[1])) { } else if (p[0] == '\\' && ascii_iswhite(p[1])) {
*q++ = p[1]; *q++ = p[1];
p += 2; p += 2;
} else if (*p == '\\' || *p == '"') { } else if (*p == '\\' || *p == '"') {
*q++ = '\\'; *q++ = '\\';
*q++ = *p++; *q++ = *p++;
} else if (vim_iswhite(*p)) { } else if (ascii_iswhite(*p)) {
p = skipwhite(p); p = skipwhite(p);
if (*p == NUL) if (*p == NUL)
break; break;
@ -8802,7 +8802,7 @@ static void ex_match(exarg_T *eap)
if (ends_excmd(*eap->arg)) if (ends_excmd(*eap->arg))
end = eap->arg; end = eap->arg;
else if ((STRNICMP(eap->arg, "none", 4) == 0 else if ((STRNICMP(eap->arg, "none", 4) == 0
&& (vim_iswhite(eap->arg[4]) || ends_excmd(eap->arg[4])))) && (ascii_iswhite(eap->arg[4]) || ends_excmd(eap->arg[4]))))
end = eap->arg + 4; end = eap->arg + 4;
else { else {
p = skiptowhite(eap->arg); p = skiptowhite(eap->arg);

View File

@ -5524,7 +5524,7 @@ static event_T event_name2nr(char_u *start, char_u **end)
int len; int len;
/* the event name ends with end of line, a blank or a comma */ /* the event name ends with end of line, a blank or a comma */
for (p = start; *p && !vim_iswhite(*p) && *p != ','; ++p) for (p = start; *p && !ascii_iswhite(*p) && *p != ','; ++p)
; ;
for (i = 0; event_names[i].name != NULL; ++i) { for (i = 0; event_names[i].name != NULL; ++i) {
len = (int)STRLEN(event_names[i].name); len = (int)STRLEN(event_names[i].name);
@ -5565,13 +5565,13 @@ find_end_event (
char_u *p; char_u *p;
if (*arg == '*') { if (*arg == '*') {
if (arg[1] && !vim_iswhite(arg[1])) { if (arg[1] && !ascii_iswhite(arg[1])) {
EMSG2(_("E215: Illegal character after *: %s"), arg); EMSG2(_("E215: Illegal character after *: %s"), arg);
return NULL; return NULL;
} }
pat = arg + 1; pat = arg + 1;
} else { } else {
for (pat = arg; *pat && !vim_iswhite(*pat); pat = p) { for (pat = arg; *pat && !ascii_iswhite(*pat); pat = p) {
if ((int)event_name2nr(pat, &p) >= (int)NUM_EVENTS) { if ((int)event_name2nr(pat, &p) >= (int)NUM_EVENTS) {
if (have_group) if (have_group)
EMSG2(_("E216: No such event: %s"), pat); EMSG2(_("E216: No such event: %s"), pat);
@ -5711,7 +5711,7 @@ void do_autocmd(char_u *arg, int forceit)
*/ */
pat = skipwhite(pat); pat = skipwhite(pat);
cmd = pat; cmd = pat;
while (*cmd && (!vim_iswhite(*cmd) || cmd[-1] == '\\')) while (*cmd && (!ascii_iswhite(*cmd) || cmd[-1] == '\\'))
cmd++; cmd++;
if (*cmd) if (*cmd)
*cmd++ = NUL; *cmd++ = NUL;
@ -5736,7 +5736,7 @@ void do_autocmd(char_u *arg, int forceit)
* Check for "nested" flag. * Check for "nested" flag.
*/ */
cmd = skipwhite(cmd); cmd = skipwhite(cmd);
if (*cmd != NUL && STRNCMP(cmd, "nested", 6) == 0 && vim_iswhite(cmd[6])) { if (*cmd != NUL && STRNCMP(cmd, "nested", 6) == 0 && ascii_iswhite(cmd[6])) {
nested = TRUE; nested = TRUE;
cmd = skipwhite(cmd + 6); cmd = skipwhite(cmd + 6);
} }
@ -5772,7 +5772,7 @@ void do_autocmd(char_u *arg, int forceit)
nested, cmd, forceit, group) == FAIL) nested, cmd, forceit, group) == FAIL)
break; break;
} else { } else {
while (*arg && !vim_iswhite(*arg)) { while (*arg && !ascii_iswhite(*arg)) {
event_T event = event_name2nr(arg, &arg); event_T event = event_name2nr(arg, &arg);
assert(event < NUM_EVENTS); assert(event < NUM_EVENTS);
if (do_autocmd_event(event, pat, nested, cmd, forceit, group) == FAIL) { if (do_autocmd_event(event, pat, nested, cmd, forceit, group) == FAIL) {
@ -6056,7 +6056,7 @@ do_doautocmd (
/* /*
* Loop over the events. * Loop over the events.
*/ */
while (*arg && !vim_iswhite(*arg)) while (*arg && !ascii_iswhite(*arg))
if (apply_autocmds_group(event_name2nr(arg, &arg), if (apply_autocmds_group(event_name2nr(arg, &arg),
fname, NULL, TRUE, group, curbuf, NULL)) fname, NULL, TRUE, group, curbuf, NULL))
nothing_done = FALSE; nothing_done = FALSE;
@ -6983,13 +6983,13 @@ set_context_in_autocmd (
group = au_get_grouparg(&arg); group = au_get_grouparg(&arg);
/* If there only is a group name that's what we expand. */ /* If there only is a group name that's what we expand. */
if (*arg == NUL && group != AUGROUP_ALL && !vim_iswhite(arg[-1])) { if (*arg == NUL && group != AUGROUP_ALL && !ascii_iswhite(arg[-1])) {
arg = p; arg = p;
group = AUGROUP_ALL; group = AUGROUP_ALL;
} }
/* skip over event name */ /* skip over event name */
for (p = arg; *p != NUL && !vim_iswhite(*p); ++p) for (p = arg; *p != NUL && !ascii_iswhite(*p); ++p)
if (*p == ',') if (*p == ',')
arg = p + 1; arg = p + 1;
if (*p == NUL) { if (*p == NUL) {
@ -7002,7 +7002,7 @@ set_context_in_autocmd (
/* skip over pattern */ /* skip over pattern */
arg = skipwhite(p); arg = skipwhite(p);
while (*arg && (!vim_iswhite(*arg) || arg[-1] == '\\')) while (*arg && (!ascii_iswhite(*arg) || arg[-1] == '\\'))
arg++; arg++;
if (*arg) if (*arg)
return arg; /* expand (next) command */ return arg; /* expand (next) command */

View File

@ -1787,7 +1787,7 @@ void foldtext_cleanup(char_u *str)
/* Ignore leading and trailing white space in 'commentstring'. */ /* Ignore leading and trailing white space in 'commentstring'. */
char_u *cms_start = skipwhite(curbuf->b_p_cms); char_u *cms_start = skipwhite(curbuf->b_p_cms);
size_t cms_slen = STRLEN(cms_start); size_t cms_slen = STRLEN(cms_start);
while (cms_slen > 0 && vim_iswhite(cms_start[cms_slen - 1])) while (cms_slen > 0 && ascii_iswhite(cms_start[cms_slen - 1]))
--cms_slen; --cms_slen;
/* locate "%s" in 'commentstring', use the part before and after it. */ /* locate "%s" in 'commentstring', use the part before and after it. */
@ -1798,7 +1798,7 @@ void foldtext_cleanup(char_u *str)
cms_slen = (size_t)(cms_end - cms_start); cms_slen = (size_t)(cms_end - cms_start);
/* exclude white space before "%s" */ /* exclude white space before "%s" */
while (cms_slen > 0 && vim_iswhite(cms_start[cms_slen - 1])) while (cms_slen > 0 && ascii_iswhite(cms_start[cms_slen - 1]))
--cms_slen; --cms_slen;
/* skip "%s" and white space after it */ /* skip "%s" and white space after it */
@ -1820,7 +1820,7 @@ void foldtext_cleanup(char_u *str)
/* May remove 'commentstring' start. Useful when it's a double /* May remove 'commentstring' start. Useful when it's a double
* quote and we already removed a double quote. */ * quote and we already removed a double quote. */
for (p = s; p > str && vim_iswhite(p[-1]); --p) for (p = s; p > str && ascii_iswhite(p[-1]); --p)
; ;
if (p >= str + cms_slen if (p >= str + cms_slen
&& STRNCMP(p - cms_slen, cms_start, cms_slen) == 0) { && STRNCMP(p - cms_slen, cms_start, cms_slen) == 0) {
@ -1838,7 +1838,7 @@ void foldtext_cleanup(char_u *str)
} }
} }
if (len != 0) { if (len != 0) {
while (vim_iswhite(s[len])) while (ascii_iswhite(s[len]))
++len; ++len;
STRMOVE(s, s + len); STRMOVE(s, s + len);
} else { } else {

View File

@ -2129,7 +2129,7 @@ static int vgetorpeek(int advance)
col = vcol = curwin->w_wcol = 0; col = vcol = curwin->w_wcol = 0;
ptr = get_cursor_line_ptr(); ptr = get_cursor_line_ptr();
while (col < curwin->w_cursor.col) { while (col < curwin->w_cursor.col) {
if (!vim_iswhite(ptr[col])) if (!ascii_iswhite(ptr[col]))
curwin->w_wcol = vcol; curwin->w_wcol = vcol;
vcol += lbr_chartabsize(ptr, ptr + col, vcol += lbr_chartabsize(ptr, ptr + col,
(colnr_T)vcol); (colnr_T)vcol);
@ -2672,7 +2672,7 @@ do_map (
*/ */
p = keys; p = keys;
do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL); do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL);
while (*p && (maptype == 1 || !vim_iswhite(*p))) { while (*p && (maptype == 1 || !ascii_iswhite(*p))) {
if ((p[0] == Ctrl_V || (do_backslash && p[0] == '\\')) && if ((p[0] == Ctrl_V || (do_backslash && p[0] == '\\')) &&
p[1] != NUL) p[1] != NUL)
++p; /* skip CTRL-V or backslash */ ++p; /* skip CTRL-V or backslash */
@ -2761,7 +2761,7 @@ do_map (
} }
/* An abbreviation cannot contain white space. */ /* An abbreviation cannot contain white space. */
for (n = 0; n < len; ++n) for (n = 0; n < len; ++n)
if (vim_iswhite(keys[n])) { if (ascii_iswhite(keys[n])) {
retval = 1; retval = 1;
goto theend; goto theend;
} }
@ -4074,7 +4074,7 @@ int put_escstr(FILE *fd, char_u *strstart, int what)
* interpreted as the start of a special key name. * interpreted as the start of a special key name.
* A space in the lhs of a :map needs a CTRL-V. * A space in the lhs of a :map needs a CTRL-V.
*/ */
if (what == 2 && (vim_iswhite(c) || c == '"' || c == '\\')) { if (what == 2 && (ascii_iswhite(c) || c == '"' || c == '\\')) {
if (putc('\\', fd) < 0) if (putc('\\', fd) < 0)
return FAIL; return FAIL;
} else if (c < ' ' || c > '~' || c == '|' } else if (c < ' ' || c > '~' || c == '|'

View File

@ -687,7 +687,7 @@ static char *cs_create_cmd(char *csoption, char *pattern)
* they may want to use the leading white space. */ * they may want to use the leading white space. */
pat = pattern; pat = pattern;
if (search != 4 && search != 6) if (search != 4 && search != 6)
while (vim_iswhite(*pat)) while (ascii_iswhite(*pat))
++pat; ++pat;
cmd = xmalloc(strlen(pat) + 2); cmd = xmalloc(strlen(pat) + 2);

View File

@ -118,7 +118,7 @@ int set_indent(int size, int flags)
ind_done = 0; ind_done = 0;
// Count as many characters as we can use. // Count as many characters as we can use.
while (todo > 0 && vim_iswhite(*p)) { while (todo > 0 && ascii_iswhite(*p)) {
if (*p == TAB) { if (*p == TAB) {
tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts); tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
@ -183,7 +183,7 @@ int set_indent(int size, int flags)
} }
// Return if the indent is OK already. // Return if the indent is OK already.
if (!doit && !vim_iswhite(*p) && !(flags & SIN_INSERT)) { if (!doit && !ascii_iswhite(*p) && !(flags & SIN_INSERT)) {
return false; return false;
} }
@ -216,7 +216,7 @@ int set_indent(int size, int flags)
// Skip over any additional white space (useful when newindent is less // Skip over any additional white space (useful when newindent is less
// than old). // than old).
while (vim_iswhite(*p)) { while (ascii_iswhite(*p)) {
p++; p++;
} }
} else { } else {
@ -235,7 +235,7 @@ int set_indent(int size, int flags)
p = oldline; p = oldline;
ind_done = 0; ind_done = 0;
while (todo > 0 && vim_iswhite(*p)) { while (todo > 0 && ascii_iswhite(*p)) {
if (*p == TAB) { if (*p == TAB) {
tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts); tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
@ -328,7 +328,7 @@ int copy_indent(int size, char_u *src)
s = src; s = src;
// Count/copy the usable portion of the source line. // Count/copy the usable portion of the source line.
while (todo > 0 && vim_iswhite(*s)) { while (todo > 0 && ascii_iswhite(*s)) {
if (*s == TAB) { if (*s == TAB) {
tab_pad = (int)curbuf->b_p_ts tab_pad = (int)curbuf->b_p_ts
- (ind_done % (int)curbuf->b_p_ts); - (ind_done % (int)curbuf->b_p_ts);
@ -502,7 +502,7 @@ int inindent(int extra)
char_u *ptr; char_u *ptr;
colnr_T col; colnr_T col;
for (col = 0, ptr = get_cursor_line_ptr(); vim_iswhite(*ptr); ++col) { for (col = 0, ptr = get_cursor_line_ptr(); ascii_iswhite(*ptr); ++col) {
ptr++; ptr++;
} }
@ -688,7 +688,7 @@ int get_lisp_indent(void)
amount++; amount++;
firsttry = amount; firsttry = amount;
while (vim_iswhite(*that)) { while (ascii_iswhite(*that)) {
amount += lbr_chartabsize(line, that, (colnr_T)amount); amount += lbr_chartabsize(line, that, (colnr_T)amount);
that++; that++;
} }
@ -706,7 +706,7 @@ int get_lisp_indent(void)
if (vi_lisp || ((*that != '"') && (*that != '\'') if (vi_lisp || ((*that != '"') && (*that != '\'')
&& (*that != '#') && ((*that < '0') || (*that > '9')))) { && (*that != '#') && ((*that < '0') || (*that > '9')))) {
while (*that && (!vim_iswhite(*that) || quotecount || parencount) while (*that && (!ascii_iswhite(*that) || quotecount || parencount)
&& (!((*that == '(' || *that == '[') && (!((*that == '(' || *that == '[')
&& !quotecount && !parencount && vi_lisp))) { && !quotecount && !parencount && vi_lisp))) {
if (*that == '"') { if (*that == '"') {
@ -726,7 +726,7 @@ int get_lisp_indent(void)
} }
} }
while (vim_iswhite(*that)) { while (ascii_iswhite(*that)) {
amount += lbr_chartabsize(line, that, (colnr_T)amount); amount += lbr_chartabsize(line, that, (colnr_T)amount);
that++; that++;
} }

View File

@ -434,7 +434,7 @@ static int cin_is_cpp_namespace(char_u *s)
if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) { if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) {
p = cin_skipcomment(skipwhite(s + 9)); p = cin_skipcomment(skipwhite(s + 9));
while (*p != NUL) { while (*p != NUL) {
if (vim_iswhite(*p)) { if (ascii_iswhite(*p)) {
has_name = TRUE; /* found end of a name */ has_name = TRUE; /* found end of a name */
p = cin_skipcomment(skipwhite(p)); p = cin_skipcomment(skipwhite(p));
} else if (*p == '{') { } else if (*p == '{') {
@ -561,15 +561,15 @@ static int cin_first_id_amount(void)
else if ((len == 8 && STRNCMP(p, "unsigned", 8) == 0) else if ((len == 8 && STRNCMP(p, "unsigned", 8) == 0)
|| (len == 6 && STRNCMP(p, "signed", 6) == 0)) { || (len == 6 && STRNCMP(p, "signed", 6) == 0)) {
s = skipwhite(p + len); s = skipwhite(p + len);
if ((STRNCMP(s, "int", 3) == 0 && vim_iswhite(s[3])) if ((STRNCMP(s, "int", 3) == 0 && ascii_iswhite(s[3]))
|| (STRNCMP(s, "long", 4) == 0 && vim_iswhite(s[4])) || (STRNCMP(s, "long", 4) == 0 && ascii_iswhite(s[4]))
|| (STRNCMP(s, "short", 5) == 0 && vim_iswhite(s[5])) || (STRNCMP(s, "short", 5) == 0 && ascii_iswhite(s[5]))
|| (STRNCMP(s, "char", 4) == 0 && vim_iswhite(s[4]))) || (STRNCMP(s, "char", 4) == 0 && ascii_iswhite(s[4])))
p = s; p = s;
} }
for (len = 0; vim_isIDc(p[len]); ++len) for (len = 0; vim_isIDc(p[len]); ++len)
; ;
if (len == 0 || !vim_iswhite(p[len]) || cin_nocode(p)) if (len == 0 || !ascii_iswhite(p[len]) || cin_nocode(p))
return 0; return 0;
p = skipwhite(p + len); p = skipwhite(p + len);
@ -889,7 +889,7 @@ static int cin_is_if_for_while_before_offset(char_u *line, int *poffset)
if (offset-- < 2) if (offset-- < 2)
return 0; return 0;
while (offset > 2 && vim_iswhite(line[offset])) while (offset > 2 && ascii_iswhite(line[offset]))
--offset; --offset;
offset -= 1; offset -= 1;
@ -1942,7 +1942,7 @@ int get_c_indent(void)
our_paren_pos.col++; our_paren_pos.col++;
else { else {
col = our_paren_pos.col + 1; col = our_paren_pos.col + 1;
while (vim_iswhite(l[col])) while (ascii_iswhite(l[col]))
col++; col++;
if (l[col] != NUL) /* In case of trailing space */ if (l[col] != NUL) /* In case of trailing space */
our_paren_pos.col = col; our_paren_pos.col = col;

View File

@ -668,7 +668,7 @@ int mb_get_class(const char_u *p)
int mb_get_class_buf(const char_u *p, buf_T *buf) int mb_get_class_buf(const char_u *p, buf_T *buf)
{ {
if (MB_BYTE2LEN(p[0]) == 1) { if (MB_BYTE2LEN(p[0]) == 1) {
if (p[0] == NUL || vim_iswhite(p[0])) if (p[0] == NUL || ascii_iswhite(p[0]))
return 0; return 0;
if (vim_iswordc_buf(p[0], buf)) if (vim_iswordc_buf(p[0], buf))
return 2; return 2;

View File

@ -117,8 +117,8 @@ ex_menu (
for (p = arg; *p; ++p) for (p = arg; *p; ++p)
if (!VIM_ISDIGIT(*p) && *p != '.') if (!VIM_ISDIGIT(*p) && *p != '.')
break; break;
if (vim_iswhite(*p)) { if (ascii_iswhite(*p)) {
for (i = 0; i < MENUDEPTH && !vim_iswhite(*arg); ++i) { for (i = 0; i < MENUDEPTH && !ascii_iswhite(*arg); ++i) {
pri_tab[i] = getdigits_int(&arg); pri_tab[i] = getdigits_int(&arg);
if (pri_tab[i] == 0) if (pri_tab[i] == 0)
pri_tab[i] = 500; pri_tab[i] = 500;
@ -138,10 +138,10 @@ ex_menu (
/* /*
* Check for "disable" or "enable" argument. * Check for "disable" or "enable" argument.
*/ */
if (STRNCMP(arg, "enable", 6) == 0 && vim_iswhite(arg[6])) { if (STRNCMP(arg, "enable", 6) == 0 && ascii_iswhite(arg[6])) {
enable = TRUE; enable = TRUE;
arg = skipwhite(arg + 6); arg = skipwhite(arg + 6);
} else if (STRNCMP(arg, "disable", 7) == 0 && vim_iswhite(arg[7])) { } else if (STRNCMP(arg, "disable", 7) == 0 && ascii_iswhite(arg[7])) {
enable = FALSE; enable = FALSE;
arg = skipwhite(arg + 7); arg = skipwhite(arg + 7);
} }
@ -838,23 +838,23 @@ char_u *set_context_in_menu_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forc
if (!VIM_ISDIGIT(*p) && *p != '.') if (!VIM_ISDIGIT(*p) && *p != '.')
break; break;
if (!vim_iswhite(*p)) { if (!ascii_iswhite(*p)) {
if (STRNCMP(arg, "enable", 6) == 0 if (STRNCMP(arg, "enable", 6) == 0
&& (arg[6] == NUL || vim_iswhite(arg[6]))) && (arg[6] == NUL || ascii_iswhite(arg[6])))
p = arg + 6; p = arg + 6;
else if (STRNCMP(arg, "disable", 7) == 0 else if (STRNCMP(arg, "disable", 7) == 0
&& (arg[7] == NUL || vim_iswhite(arg[7]))) && (arg[7] == NUL || ascii_iswhite(arg[7])))
p = arg + 7; p = arg + 7;
else else
p = arg; p = arg;
} }
while (*p != NUL && vim_iswhite(*p)) while (*p != NUL && ascii_iswhite(*p))
++p; ++p;
arg = after_dot = p; arg = after_dot = p;
for (; *p && !vim_iswhite(*p); ++p) { for (; *p && !ascii_iswhite(*p); ++p) {
if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL) if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL)
p++; p++;
else if (*p == '.') else if (*p == '.')
@ -864,7 +864,7 @@ char_u *set_context_in_menu_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forc
/* ":tearoff" and ":popup" only use menus, not entries */ /* ":tearoff" and ":popup" only use menus, not entries */
expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p'); expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p');
expand_emenu = (*cmd == 'e'); expand_emenu = (*cmd == 'e');
if (expand_menus && vim_iswhite(*p)) if (expand_menus && ascii_iswhite(*p))
return NULL; /* TODO: check for next command? */ return NULL; /* TODO: check for next command? */
if (*p == NUL) { /* Complete the menu name */ if (*p == NUL) { /* Complete the menu name */
/* /*
@ -1484,7 +1484,7 @@ void ex_menutranslate(exarg_T *eap)
*/ */
static char_u *menu_skip_part(char_u *p) static char_u *menu_skip_part(char_u *p)
{ {
while (*p != NUL && *p != '.' && !vim_iswhite(*p)) { while (*p != NUL && *p != '.' && !ascii_iswhite(*p)) {
if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL) if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL)
++p; ++p;
++p; ++p;
@ -1543,7 +1543,7 @@ static char_u *menu_translate_tab_and_shift(char_u *arg_start)
{ {
char_u *arg = arg_start; char_u *arg = arg_start;
while (*arg && !vim_iswhite(*arg)) { while (*arg && !ascii_iswhite(*arg)) {
if ((*arg == '\\' || *arg == Ctrl_V) && arg[1] != NUL) if ((*arg == '\\' || *arg == Ctrl_V) && arg[1] != NUL)
arg++; arg++;
else if (STRNICMP(arg, "<TAB>", 5) == 0) { else if (STRNICMP(arg, "<TAB>", 5) == 0) {

View File

@ -1387,7 +1387,7 @@ void msg_prt_line(char_u *s, int list)
/* find start of trailing whitespace */ /* find start of trailing whitespace */
if (list && lcs_trail) { if (list && lcs_trail) {
trail = s + STRLEN(s); trail = s + STRLEN(s);
while (trail > s && vim_iswhite(trail[-1])) while (trail > s && ascii_iswhite(trail[-1]))
--trail; --trail;
} }

View File

@ -266,7 +266,7 @@ open_line (
} else { /* Not a comment line */ } else { /* Not a comment line */
/* Find last non-blank in line */ /* Find last non-blank in line */
p = ptr + STRLEN(ptr) - 1; p = ptr + STRLEN(ptr) - 1;
while (p > ptr && vim_iswhite(*p)) while (p > ptr && ascii_iswhite(*p))
--p; --p;
last_char = *p; last_char = *p;
@ -276,7 +276,7 @@ open_line (
if (last_char == '{' || last_char == ';') { if (last_char == '{' || last_char == ';') {
if (p > ptr) if (p > ptr)
--p; --p;
while (p > ptr && vim_iswhite(*p)) while (p > ptr && ascii_iswhite(*p))
--p; --p;
} }
/* /*
@ -442,7 +442,7 @@ open_line (
* comment leader, then put a space after the middle * comment leader, then put a space after the middle
* comment leader on the next line. * comment leader on the next line.
*/ */
if (!vim_iswhite(saved_line[lead_len - 1]) if (!ascii_iswhite(saved_line[lead_len - 1])
&& ((p_extra != NULL && ((p_extra != NULL
&& (int)curwin->w_cursor.col == lead_len) && (int)curwin->w_cursor.col == lead_len)
|| (p_extra == NULL || (p_extra == NULL
@ -532,7 +532,7 @@ open_line (
if (c == COM_RIGHT) { /* right adjusted leader */ if (c == COM_RIGHT) { /* right adjusted leader */
/* find last non-white in the leader to line up with */ /* find last non-white in the leader to line up with */
for (p = leader + lead_len - 1; p > leader for (p = leader + lead_len - 1; p > leader
&& vim_iswhite(*p); --p) && ascii_iswhite(*p); --p)
; ;
++p; ++p;
@ -573,7 +573,7 @@ open_line (
(size_t)((leader + lead_len) - (p + l + 1))); (size_t)((leader + lead_len) - (p + l + 1)));
lead_len -= l; lead_len -= l;
*p = ' '; *p = ' ';
} else if (!vim_iswhite(*p)) } else if (!ascii_iswhite(*p))
*p = ' '; *p = ' ';
} }
} else { /* left adjusted leader */ } else { /* left adjusted leader */
@ -604,7 +604,7 @@ open_line (
* leader by spaces. Keep Tabs, the indent must * leader by spaces. Keep Tabs, the indent must
* remain the same. */ * remain the same. */
for (p += lead_repl_len; p < leader + lead_len; ++p) for (p += lead_repl_len; p < leader + lead_len; ++p)
if (!vim_iswhite(*p)) { if (!ascii_iswhite(*p)) {
/* Don't put a space before a TAB. */ /* Don't put a space before a TAB. */
if (p + 1 < leader + lead_len && p[1] == TAB) { if (p + 1 < leader + lead_len && p[1] == TAB) {
--lead_len; --lead_len;
@ -656,7 +656,7 @@ open_line (
/* If the leader ends in white space, don't add an /* If the leader ends in white space, don't add an
* extra space */ * extra space */
if (lead_len > 0 && vim_iswhite(leader[lead_len - 1])) if (lead_len > 0 && ascii_iswhite(leader[lead_len - 1]))
extra_space = FALSE; extra_space = FALSE;
leader[lead_len] = NUL; leader[lead_len] = NUL;
} }
@ -675,7 +675,7 @@ open_line (
if (newindent if (newindent
|| did_si || did_si
) { ) {
while (lead_len && vim_iswhite(*leader)) { while (lead_len && ascii_iswhite(*leader)) {
--lead_len; --lead_len;
--newcol; --newcol;
++leader; ++leader;
@ -966,7 +966,7 @@ int get_leader_len(char_u *line, char_u **flags, int backward, int include_space
char_u *saved_flags = NULL; char_u *saved_flags = NULL;
result = i = 0; result = i = 0;
while (vim_iswhite(line[i])) /* leading white space is ignored */ while (ascii_iswhite(line[i])) /* leading white space is ignored */
++i; ++i;
/* /*
@ -1009,10 +1009,10 @@ int get_leader_len(char_u *line, char_u **flags, int backward, int include_space
* When string starts with white space, must have some white space * When string starts with white space, must have some white space
* (but the amount does not need to match, there might be a mix of * (but the amount does not need to match, there might be a mix of
* TABs and spaces). */ * TABs and spaces). */
if (vim_iswhite(string[0])) { if (ascii_iswhite(string[0])) {
if (i == 0 || !vim_iswhite(line[i - 1])) if (i == 0 || !ascii_iswhite(line[i - 1]))
continue; /* missing white space */ continue; /* missing white space */
while (vim_iswhite(string[0])) while (ascii_iswhite(string[0]))
++string; ++string;
} }
for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j)
@ -1023,7 +1023,7 @@ int get_leader_len(char_u *line, char_u **flags, int backward, int include_space
/* When 'b' flag used, there must be white space or an /* When 'b' flag used, there must be white space or an
* end-of-line after the string in the line. */ * end-of-line after the string in the line. */
if (vim_strchr(part_buf, COM_BLANK) != NULL if (vim_strchr(part_buf, COM_BLANK) != NULL
&& !vim_iswhite(line[i + j]) && line[i + j] != NUL) && !ascii_iswhite(line[i + j]) && line[i + j] != NUL)
continue; continue;
/* We have found a match, stop searching unless this is a middle /* We have found a match, stop searching unless this is a middle
@ -1065,7 +1065,7 @@ int get_leader_len(char_u *line, char_u **flags, int backward, int include_space
result = i; result = i;
/* Include any trailing white space. */ /* Include any trailing white space. */
while (vim_iswhite(line[i])) while (ascii_iswhite(line[i]))
++i; ++i;
if (include_space) if (include_space)
@ -1129,10 +1129,10 @@ int get_last_leader_offset(char_u *line, char_u **flags)
* (but the amount does not need to match, there might be a mix of * (but the amount does not need to match, there might be a mix of
* TABs and spaces). * TABs and spaces).
*/ */
if (vim_iswhite(string[0])) { if (ascii_iswhite(string[0])) {
if (i == 0 || !vim_iswhite(line[i - 1])) if (i == 0 || !ascii_iswhite(line[i - 1]))
continue; continue;
while (vim_iswhite(string[0])) while (ascii_iswhite(string[0]))
++string; ++string;
} }
for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j)
@ -1145,7 +1145,7 @@ int get_last_leader_offset(char_u *line, char_u **flags)
* end-of-line after the string in the line. * end-of-line after the string in the line.
*/ */
if (vim_strchr(part_buf, COM_BLANK) != NULL if (vim_strchr(part_buf, COM_BLANK) != NULL
&& !vim_iswhite(line[i + j]) && line[i + j] != NUL) { && !ascii_iswhite(line[i + j]) && line[i + j] != NUL) {
continue; continue;
} }
@ -1180,7 +1180,7 @@ int get_last_leader_offset(char_u *line, char_u **flags)
* the comment leader correctly. * the comment leader correctly.
*/ */
while (vim_iswhite(*com_leader)) while (ascii_iswhite(*com_leader))
++com_leader; ++com_leader;
len1 = (int)STRLEN(com_leader); len1 = (int)STRLEN(com_leader);
@ -1192,7 +1192,7 @@ int get_last_leader_offset(char_u *line, char_u **flags)
continue; continue;
string = vim_strchr(part_buf2, ':'); string = vim_strchr(part_buf2, ':');
++string; ++string;
while (vim_iswhite(*string)) while (ascii_iswhite(*string))
++string; ++string;
len2 = (int)STRLEN(string); len2 = (int)STRLEN(string);
if (len2 == 0) if (len2 == 0)

View File

@ -2365,7 +2365,7 @@ do_mouse (
* not a word character, try finding a match and select a (), * not a word character, try finding a match and select a (),
* {}, [], #if/#endif, etc. block. */ * {}, [], #if/#endif, etc. block. */
end_visual = curwin->w_cursor; end_visual = curwin->w_cursor;
while (gc = gchar_pos(&end_visual), vim_iswhite(gc)) while (gc = gchar_pos(&end_visual), ascii_iswhite(gc))
inc(&end_visual); inc(&end_visual);
if (oap != NULL) if (oap != NULL)
oap->motion_type = MCHAR; oap->motion_type = MCHAR;
@ -2627,7 +2627,7 @@ int find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char_u **strin
} }
} else } else
while (ptr[col] != NUL while (ptr[col] != NUL
&& (i == 0 ? !vim_iswordc(ptr[col]) : vim_iswhite(ptr[col])) && (i == 0 ? !vim_iswordc(ptr[col]) : ascii_iswhite(ptr[col]))
) )
++col; ++col;
@ -2660,7 +2660,7 @@ int find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char_u **strin
while (col > 0 while (col > 0
&& ((i == 0 && ((i == 0
? vim_iswordc(ptr[col - 1]) ? vim_iswordc(ptr[col - 1])
: (!vim_iswhite(ptr[col - 1]) : (!ascii_iswhite(ptr[col - 1])
&& (!(find_type & FIND_IDENT) && (!(find_type & FIND_IDENT)
|| !vim_iswordc(ptr[col - 1])))) || !vim_iswordc(ptr[col - 1]))))
)) ))
@ -2702,7 +2702,7 @@ int find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char_u **strin
col += (*mb_ptr2len)(ptr + col); col += (*mb_ptr2len)(ptr + col);
} else } else
while ((i == 0 ? vim_iswordc(ptr[col]) while ((i == 0 ? vim_iswordc(ptr[col])
: (ptr[col] != NUL && !vim_iswhite(ptr[col]))) : (ptr[col] != NUL && !ascii_iswhite(ptr[col])))
) { ) {
++col; ++col;
} }
@ -6177,7 +6177,7 @@ static void nv_g_cmd(cmdarg_T *cap)
if (flag) { if (flag) {
do do
i = gchar_cursor(); i = gchar_cursor();
while (vim_iswhite(i) && oneright()); while (ascii_iswhite(i) && oneright());
} }
curwin->w_set_curswant = true; curwin->w_set_curswant = true;
break; break;
@ -6200,7 +6200,7 @@ static void nv_g_cmd(cmdarg_T *cap)
/* Decrease the cursor column until it's on a non-blank. */ /* Decrease the cursor column until it's on a non-blank. */
while (curwin->w_cursor.col > 0 while (curwin->w_cursor.col > 0
&& vim_iswhite(ptr[curwin->w_cursor.col])) && ascii_iswhite(ptr[curwin->w_cursor.col]))
--curwin->w_cursor.col; --curwin->w_cursor.col;
curwin->w_set_curswant = true; curwin->w_set_curswant = true;
adjust_for_sel(cap); adjust_for_sel(cap);
@ -6715,7 +6715,7 @@ static void nv_wordcmd(cmdarg_T *cap)
if (!word_end && cap->oap->op_type == OP_CHANGE) { if (!word_end && cap->oap->op_type == OP_CHANGE) {
n = gchar_cursor(); n = gchar_cursor();
if (n != NUL) { /* not an empty line */ if (n != NUL) { /* not an empty line */
if (vim_iswhite(n)) { if (ascii_iswhite(n)) {
/* /*
* Reproduce a funny Vi behaviour: "cw" on a blank only * Reproduce a funny Vi behaviour: "cw" on a blank only
* changes one character, not all blanks until the start of * changes one character, not all blanks until the start of

View File

@ -347,7 +347,7 @@ static void shift_block(oparg_T *oap, int amount)
else else
++bd.textstart; ++bd.textstart;
} }
for (; vim_iswhite(*bd.textstart); ) { for (; ascii_iswhite(*bd.textstart); ) {
// TODO: is passing bd.textstart for start of the line OK? // TODO: is passing bd.textstart for start of the line OK?
incr = lbr_chartabsize_adv(bd.textstart, &bd.textstart, (colnr_T)(bd.start_vcol)); incr = lbr_chartabsize_adv(bd.textstart, &bd.textstart, (colnr_T)(bd.start_vcol));
total += incr; total += incr;
@ -403,7 +403,7 @@ static void shift_block(oparg_T *oap, int amount)
/* The character's column is in "bd.start_vcol". */ /* The character's column is in "bd.start_vcol". */
non_white_col = bd.start_vcol; non_white_col = bd.start_vcol;
while (vim_iswhite(*non_white)) { while (ascii_iswhite(*non_white)) {
incr = lbr_chartabsize_adv(bd.textstart, &non_white, non_white_col); incr = lbr_chartabsize_adv(bd.textstart, &non_white, non_white_col);
non_white_col += incr; non_white_col += incr;
} }
@ -3613,15 +3613,15 @@ static int same_leader(linenr_T lnum, int leader1_len, char_u *leader1_flags, in
* The first line has to be saved, only one line can be locked at a time. * The first line has to be saved, only one line can be locked at a time.
*/ */
line1 = vim_strsave(ml_get(lnum)); line1 = vim_strsave(ml_get(lnum));
for (idx1 = 0; vim_iswhite(line1[idx1]); ++idx1) for (idx1 = 0; ascii_iswhite(line1[idx1]); ++idx1)
; ;
line2 = ml_get(lnum + 1); line2 = ml_get(lnum + 1);
for (idx2 = 0; idx2 < leader2_len; ++idx2) { for (idx2 = 0; idx2 < leader2_len; ++idx2) {
if (!vim_iswhite(line2[idx2])) { if (!ascii_iswhite(line2[idx2])) {
if (line1[idx1++] != line2[idx2]) if (line1[idx1++] != line2[idx2])
break; break;
} else } else
while (vim_iswhite(line1[idx1])) while (ascii_iswhite(line1[idx1]))
++idx1; ++idx1;
} }
xfree(line1); xfree(line1);
@ -3979,10 +3979,10 @@ static int ends_in_white(linenr_T lnum)
if (*s == NUL) if (*s == NUL)
return FALSE; return FALSE;
/* Don't use STRLEN() inside vim_iswhite(), SAS/C complains: "macro /* Don't use STRLEN() inside ascii_iswhite(), SAS/C complains: "macro
* invocation may call function multiple times". */ * invocation may call function multiple times". */
l = STRLEN(s) - 1; l = STRLEN(s) - 1;
return vim_iswhite(s[l]); return ascii_iswhite(s[l]);
} }
/* /*
@ -4103,7 +4103,7 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int i
/* Count a tab for what it's worth (if list mode not on) */ /* Count a tab for what it's worth (if list mode not on) */
incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol); incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol);
bdp->start_vcol += incr; bdp->start_vcol += incr;
if (vim_iswhite(*pstart)) { if (ascii_iswhite(*pstart)) {
bdp->pre_whitesp += incr; bdp->pre_whitesp += incr;
bdp->pre_whitesp_c++; bdp->pre_whitesp_c++;
} else { } else {

View File

@ -2461,7 +2461,7 @@ do_set (
afterchar = arg[len]; afterchar = arg[len];
/* skip white space, allow ":set ai ?" */ /* skip white space, allow ":set ai ?" */
while (vim_iswhite(arg[len])) while (ascii_iswhite(arg[len]))
++len; ++len;
adding = FALSE; adding = FALSE;
@ -2549,7 +2549,7 @@ do_set (
} }
} }
if (vim_strchr((char_u *)"?!&<", nextchar) != NULL if (vim_strchr((char_u *)"?!&<", nextchar) != NULL
&& arg[1] != NUL && !vim_iswhite(arg[1])) { && arg[1] != NUL && !ascii_iswhite(arg[1])) {
errmsg = e_trailing; errmsg = e_trailing;
goto skip; goto skip;
} }
@ -2590,7 +2590,7 @@ do_set (
goto skip; goto skip;
} }
if (nextchar != '?' if (nextchar != '?'
&& nextchar != NUL && !vim_iswhite(afterchar)) && nextchar != NUL && !ascii_iswhite(afterchar))
errmsg = e_trailing; errmsg = e_trailing;
} else { } else {
if (flags & P_BOOL) { /* boolean */ if (flags & P_BOOL) { /* boolean */
@ -2623,7 +2623,7 @@ do_set (
* ":set invopt": invert * ":set invopt": invert
* ":set opt" or ":set noopt": set or reset * ":set opt" or ":set noopt": set or reset
*/ */
if (nextchar != NUL && !vim_iswhite(afterchar)) { if (nextchar != NUL && !ascii_iswhite(afterchar)) {
errmsg = e_trailing; errmsg = e_trailing;
goto skip; goto skip;
} }
@ -2670,7 +2670,7 @@ do_set (
|| (long *)varp == &p_wcm) || (long *)varp == &p_wcm)
&& (*arg == '<' && (*arg == '<'
|| *arg == '^' || *arg == '^'
|| ((!arg[1] || vim_iswhite(arg[1])) || ((!arg[1] || ascii_iswhite(arg[1]))
&& !VIM_ISDIGIT(*arg)))) { && !VIM_ISDIGIT(*arg)))) {
value = string_to_key(arg); value = string_to_key(arg);
if (value == 0 && (long *)varp != &p_wcm) { if (value == 0 && (long *)varp != &p_wcm) {
@ -2688,7 +2688,7 @@ do_set (
i += 2; i += 2;
while (VIM_ISDIGIT(arg[i])) while (VIM_ISDIGIT(arg[i]))
++i; ++i;
if (arg[i] != NUL && !vim_iswhite(arg[i])) { if (arg[i] != NUL && !ascii_iswhite(arg[i])) {
errmsg = e_invarg; errmsg = e_invarg;
goto skip; goto skip;
} }
@ -2848,7 +2848,7 @@ do_set (
* do remove it for "\\\\machine\\path". * do remove it for "\\\\machine\\path".
* The reverse is found in ExpandOldSetting(). * The reverse is found in ExpandOldSetting().
*/ */
while (*arg && !vim_iswhite(*arg)) { while (*arg && !ascii_iswhite(*arg)) {
if (*arg == '\\' && arg[1] != NUL if (*arg == '\\' && arg[1] != NUL
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
&& !((flags & P_EXPAND) && !((flags & P_EXPAND)
@ -3004,7 +3004,7 @@ skip:
* - skip one "=val" argument (for hidden options ":set gfn =xx") * - skip one "=val" argument (for hidden options ":set gfn =xx")
*/ */
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
while (*arg != NUL && !vim_iswhite(*arg)) while (*arg != NUL && !ascii_iswhite(*arg))
if (*arg++ == '\\' && *arg != NUL) if (*arg++ == '\\' && *arg != NUL)
++arg; ++arg;
arg = skipwhite(arg); arg = skipwhite(arg);

View File

@ -340,7 +340,7 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
STRCAT(command, pat[0] + 1); /* exclude first backtick */ STRCAT(command, pat[0] + 1); /* exclude first backtick */
p = command + STRLEN(command) - 1; p = command + STRLEN(command) - 1;
*p-- = ')'; /* remove last backtick */ *p-- = ')'; /* remove last backtick */
while (p > command && vim_iswhite(*p)) while (p > command && ascii_iswhite(*p))
--p; --p;
if (*p == '&') { /* remove trailing '&' */ if (*p == '&') { /* remove trailing '&' */
ampersent = TRUE; ampersent = TRUE;

View File

@ -1808,7 +1808,7 @@ static void qf_fmt_text(char_u *text, char_u *buf, int bufsize)
if (*p == '\n') { if (*p == '\n') {
buf[i] = ' '; buf[i] = ' ';
while (*++p != NUL) while (*++p != NUL)
if (!vim_iswhite(*p) && *p != '\n') if (!ascii_iswhite(*p) && *p != '\n')
break; break;
} else } else
buf[i] = *p++; buf[i] = *p++;

View File

@ -3993,14 +3993,14 @@ regmatch (
break; break;
case WHITE: case WHITE:
if (!vim_iswhite(c)) if (!ascii_iswhite(c))
status = RA_NOMATCH; status = RA_NOMATCH;
else else
ADVANCE_REGINPUT(); ADVANCE_REGINPUT();
break; break;
case NWHITE: case NWHITE:
if (c == NUL || vim_iswhite(c)) if (c == NUL || ascii_iswhite(c))
status = RA_NOMATCH; status = RA_NOMATCH;
else else
ADVANCE_REGINPUT(); ADVANCE_REGINPUT();

View File

@ -5524,12 +5524,12 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
break; break;
case NFA_WHITE: /* \s */ case NFA_WHITE: /* \s */
result = vim_iswhite(curc); result = ascii_iswhite(curc);
ADD_STATE_IF_MATCH(t->state); ADD_STATE_IF_MATCH(t->state);
break; break;
case NFA_NWHITE: /* \S */ case NFA_NWHITE: /* \S */
result = curc != NUL && !vim_iswhite(curc); result = curc != NUL && !ascii_iswhite(curc);
ADD_STATE_IF_MATCH(t->state); ADD_STATE_IF_MATCH(t->state);
break; break;

View File

@ -2401,7 +2401,7 @@ win_line (
/* find start of trailing whitespace */ /* find start of trailing whitespace */
if (wp->w_p_list && lcs_trail) { if (wp->w_p_list && lcs_trail) {
trailcol = (colnr_T)STRLEN(ptr); trailcol = (colnr_T)STRLEN(ptr);
while (trailcol > (colnr_T)0 && vim_iswhite(ptr[trailcol - 1])) while (trailcol > (colnr_T)0 && ascii_iswhite(ptr[trailcol - 1]))
--trailcol; --trailcol;
trailcol += (colnr_T) (ptr - line); trailcol += (colnr_T) (ptr - line);
extra_check = TRUE; extra_check = TRUE;
@ -3319,7 +3319,7 @@ win_line (
- vcol % (int)wp->w_buffer->b_p_ts - 1; - vcol % (int)wp->w_buffer->b_p_ts - 1;
} }
c_extra = ' '; c_extra = ' ';
if (vim_iswhite(c)) { if (ascii_iswhite(c)) {
if (c == TAB) if (c == TAB)
/* See "Tab alignment" below. */ /* See "Tab alignment" below. */
FIX_FOR_BOGUSCOLS; FIX_FOR_BOGUSCOLS;

View File

@ -2616,7 +2616,7 @@ static void find_first_blank(pos_T *posp)
while (decl(posp) != -1) { while (decl(posp) != -1) {
c = gchar_pos(posp); c = gchar_pos(posp);
if (!vim_iswhite(c)) { if (!ascii_iswhite(c)) {
incl(posp); incl(posp);
break; break;
} }
@ -2828,7 +2828,7 @@ extend:
decl(&pos); decl(&pos);
while (lt(pos, curwin->w_cursor)) { while (lt(pos, curwin->w_cursor)) {
c = gchar_pos(&pos); c = gchar_pos(&pos);
if (!vim_iswhite(c)) { if (!ascii_iswhite(c)) {
at_start_sent = FALSE; at_start_sent = FALSE;
break; break;
} }
@ -2848,7 +2848,7 @@ extend:
if (at_start_sent) if (at_start_sent)
find_first_blank(&curwin->w_cursor); find_first_blank(&curwin->w_cursor);
c = gchar_cursor(); c = gchar_cursor();
if (!at_start_sent || (!include && !vim_iswhite(c))) if (!at_start_sent || (!include && !ascii_iswhite(c)))
findsent(BACKWARD, 1L); findsent(BACKWARD, 1L);
at_start_sent = !at_start_sent; at_start_sent = !at_start_sent;
} }
@ -2866,7 +2866,7 @@ extend:
at_start_sent = FALSE; at_start_sent = FALSE;
while (lt(pos, curwin->w_cursor)) { while (lt(pos, curwin->w_cursor)) {
c = gchar_pos(&pos); c = gchar_pos(&pos);
if (!vim_iswhite(c)) { if (!ascii_iswhite(c)) {
at_start_sent = TRUE; at_start_sent = TRUE;
break; break;
} }
@ -2891,7 +2891,7 @@ extend:
* If the cursor started on a blank, check if it is just before the start * If the cursor started on a blank, check if it is just before the start
* of the next sentence. * of the next sentence.
*/ */
while (c = gchar_pos(&pos), vim_iswhite(c)) /* vim_iswhite() is a macro */ while (c = gchar_pos(&pos), ascii_iswhite(c))
incl(&pos); incl(&pos);
if (equalpos(pos, curwin->w_cursor)) { if (equalpos(pos, curwin->w_cursor)) {
start_blank = TRUE; start_blank = TRUE;
@ -2921,10 +2921,10 @@ extend:
*/ */
if (start_blank) { if (start_blank) {
find_first_blank(&curwin->w_cursor); find_first_blank(&curwin->w_cursor);
c = gchar_pos(&curwin->w_cursor); /* vim_iswhite() is a macro */ c = gchar_pos(&curwin->w_cursor); /* ascii_iswhite() is a macro */
if (vim_iswhite(c)) if (ascii_iswhite(c))
decl(&curwin->w_cursor); decl(&curwin->w_cursor);
} else if (c = gchar_cursor(), !vim_iswhite(c)) } else if (c = gchar_cursor(), !ascii_iswhite(c))
find_first_blank(&start_pos); find_first_blank(&start_pos);
} }
@ -3231,7 +3231,7 @@ again:
*/ */
inc_cursor(); inc_cursor();
p = get_cursor_pos_ptr(); p = get_cursor_pos_ptr();
for (cp = p; *cp != NUL && *cp != '>' && !vim_iswhite(*cp); mb_ptr_adv(cp)) for (cp = p; *cp != NUL && *cp != '>' && !ascii_iswhite(*cp); mb_ptr_adv(cp))
; ;
len = (int)(cp - p); len = (int)(cp - p);
if (len == 0) { if (len == 0) {
@ -3679,11 +3679,11 @@ current_quote (
/* When "include" is TRUE, include spaces after closing quote or before /* When "include" is TRUE, include spaces after closing quote or before
* the starting quote. */ * the starting quote. */
if (include) { if (include) {
if (vim_iswhite(line[col_end + 1])) if (ascii_iswhite(line[col_end + 1]))
while (vim_iswhite(line[col_end + 1])) while (ascii_iswhite(line[col_end + 1]))
++col_end; ++col_end;
else else
while (col_start > 0 && vim_iswhite(line[col_start - 1])) while (col_start > 0 && ascii_iswhite(line[col_start - 1]))
--col_start; --col_start;
} }

View File

@ -9501,7 +9501,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
fword_ends = (fword[sp->ts_fidx] == NUL fword_ends = (fword[sp->ts_fidx] == NUL
|| (soundfold || (soundfold
? vim_iswhite(fword[sp->ts_fidx]) ? ascii_iswhite(fword[sp->ts_fidx])
: !spell_iswordp(fword + sp->ts_fidx, curwin))); : !spell_iswordp(fword + sp->ts_fidx, curwin)));
tword[sp->ts_twordlen] = NUL; tword[sp->ts_twordlen] = NUL;
@ -10915,7 +10915,7 @@ stp_sal_score (
// sounds like "t h" while "the" sounds like "@". Avoid that by // sounds like "t h" while "the" sounds like "@". Avoid that by
// removing the space. Don't do it when the good word also contains a // removing the space. Don't do it when the good word also contains a
// space. // space.
if (vim_iswhite(su->su_badptr[su->su_badlen]) if (ascii_iswhite(su->su_badptr[su->su_badlen])
&& *skiptowhite(stp->st_word) == NUL) && *skiptowhite(stp->st_word) == NUL)
for (p = fword; *(p = skiptowhite(p)) != NUL; ) for (p = fword; *(p = skiptowhite(p)) != NUL; )
STRMOVE(p, p + 1); STRMOVE(p, p + 1);
@ -11695,7 +11695,7 @@ static void spell_soundfold_sofo(slang_T *slang, char_u *inword, char_u *res)
// 255, sl_sal the rest. // 255, sl_sal the rest.
for (s = inword; *s != NUL; ) { for (s = inword; *s != NUL; ) {
c = mb_cptr2char_adv(&s); c = mb_cptr2char_adv(&s);
if (enc_utf8 ? utf_class(c) == 0 : vim_iswhite(c)) if (enc_utf8 ? utf_class(c) == 0 : ascii_iswhite(c))
c = ' '; c = ' ';
else if (c < 256) else if (c < 256)
c = slang->sl_sal_first[c]; c = slang->sl_sal_first[c];
@ -11727,7 +11727,7 @@ static void spell_soundfold_sofo(slang_T *slang, char_u *inword, char_u *res)
} else { } else {
// The sl_sal_first[] table contains the translation. // The sl_sal_first[] table contains the translation.
for (s = inword; (c = *s) != NUL; ++s) { for (s = inword; (c = *s) != NUL; ++s) {
if (vim_iswhite(c)) if (ascii_iswhite(c))
c = ' '; c = ' ';
else else
c = slang->sl_sal_first[c]; c = slang->sl_sal_first[c];
@ -11762,7 +11762,7 @@ static void spell_soundfold_sal(slang_T *slang, char_u *inword, char_u *res)
if (slang->sl_rem_accents) { if (slang->sl_rem_accents) {
t = word; t = word;
while (*s != NUL) { while (*s != NUL) {
if (vim_iswhite(*s)) { if (ascii_iswhite(*s)) {
*t++ = ' '; *t++ = ' ';
s = skipwhite(s); s = skipwhite(s);
} else { } else {
@ -11955,7 +11955,7 @@ static void spell_soundfold_sal(slang_T *slang, char_u *inword, char_u *res)
break; break;
} }
} }
} else if (vim_iswhite(c)) { } else if (ascii_iswhite(c)) {
c = ' '; c = ' ';
k = 1; k = 1;
} }
@ -12010,7 +12010,7 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
t = s; t = s;
c = mb_cptr2char_adv(&s); c = mb_cptr2char_adv(&s);
if (slang->sl_rem_accents) { if (slang->sl_rem_accents) {
if (enc_utf8 ? utf_class(c) == 0 : vim_iswhite(c)) { if (enc_utf8 ? utf_class(c) == 0 : ascii_iswhite(c)) {
if (did_white) if (did_white)
continue; continue;
c = ' '; c = ' ';
@ -12221,7 +12221,7 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
break; break;
} }
} }
} else if (vim_iswhite(c)) { } else if (ascii_iswhite(c)) {
c = ' '; c = ' ';
k = 1; k = 1;
} }

View File

@ -295,7 +295,7 @@ void del_trailing_spaces(char_u *ptr)
char_u *q; char_u *q;
q = ptr + STRLEN(ptr); q = ptr + STRLEN(ptr);
while (--q > ptr && vim_iswhite(q[0]) && q[-1] != '\\' && q[-1] != Ctrl_V) while (--q > ptr && ascii_iswhite(q[0]) && q[-1] != '\\' && q[-1] != Ctrl_V)
*q = NUL; *q = NUL;
} }

View File

@ -1973,7 +1973,7 @@ syn_current_attr (
if (!found_match) { if (!found_match) {
line = syn_getcurline(); line = syn_getcurline();
if (((current_next_flags & HL_SKIPWHITE) if (((current_next_flags & HL_SKIPWHITE)
&& vim_iswhite(line[current_col])) && ascii_iswhite(line[current_col]))
|| ((current_next_flags & HL_SKIPEMPTY) || ((current_next_flags & HL_SKIPEMPTY)
&& *line == NUL)) && *line == NUL))
break; break;
@ -3941,7 +3941,7 @@ get_syn_options (
for (i = 0, len = 0; p[i] != NUL; i += 2, ++len) for (i = 0, len = 0; p[i] != NUL; i += 2, ++len)
if (arg[len] != p[i] && arg[len] != p[i + 1]) if (arg[len] != p[i] && arg[len] != p[i + 1])
break; break;
if (p[i] == NUL && (vim_iswhite(arg[len]) if (p[i] == NUL && (ascii_iswhite(arg[len])
|| (flagtab[fidx].argtype > 0 || (flagtab[fidx].argtype > 0
? arg[len] == '=' ? arg[len] == '='
: ends_excmd(arg[len])))) { : ends_excmd(arg[len])))) {
@ -4161,7 +4161,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
if (rest == NULL || ends_excmd(*rest)) if (rest == NULL || ends_excmd(*rest))
break; break;
/* Copy the keyword, removing backslashes, and add a NUL. */ /* Copy the keyword, removing backslashes, and add a NUL. */
while (*rest != NUL && !vim_iswhite(*rest)) { while (*rest != NUL && !ascii_iswhite(*rest)) {
if (*rest == '\\' && rest[1] != NUL) if (*rest == '\\' && rest[1] != NUL)
++rest; ++rest;
*p++ = *rest++; *p++ = *rest++;
@ -4386,7 +4386,7 @@ syn_cmd_region (
/* must be a pattern or matchgroup then */ /* must be a pattern or matchgroup then */
key_end = rest; key_end = rest;
while (*key_end && !vim_iswhite(*key_end) && *key_end != '=') while (*key_end && !ascii_iswhite(*key_end) && *key_end != '=')
++key_end; ++key_end;
xfree(key); xfree(key);
key = vim_strnsave_up(rest, (int)(key_end - rest)); key = vim_strnsave_up(rest, (int)(key_end - rest));
@ -4791,15 +4791,15 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
for (;; ) { for (;; ) {
if (STRNICMP(rest, "add", 3) == 0 if (STRNICMP(rest, "add", 3) == 0
&& (vim_iswhite(rest[3]) || rest[3] == '=')) { && (ascii_iswhite(rest[3]) || rest[3] == '=')) {
opt_len = 3; opt_len = 3;
list_op = CLUSTER_ADD; list_op = CLUSTER_ADD;
} else if (STRNICMP(rest, "remove", 6) == 0 } else if (STRNICMP(rest, "remove", 6) == 0
&& (vim_iswhite(rest[6]) || rest[6] == '=')) { && (ascii_iswhite(rest[6]) || rest[6] == '=')) {
opt_len = 6; opt_len = 6;
list_op = CLUSTER_SUBTRACT; list_op = CLUSTER_SUBTRACT;
} else if (STRNICMP(rest, "contains", 8) == 0 } else if (STRNICMP(rest, "contains", 8) == 0
&& (vim_iswhite(rest[8]) || rest[8] == '=')) { && (ascii_iswhite(rest[8]) || rest[8] == '=')) {
opt_len = 8; opt_len = 8;
list_op = CLUSTER_REPLACE; list_op = CLUSTER_REPLACE;
} else } else
@ -4916,7 +4916,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
} }
} while (idx >= 0); } while (idx >= 0);
if (!ends_excmd(*end) && !vim_iswhite(*end)) { if (!ends_excmd(*end) && !ascii_iswhite(*end)) {
EMSG2(_("E402: Garbage after pattern: %s"), arg); EMSG2(_("E402: Garbage after pattern: %s"), arg);
return NULL; return NULL;
} }
@ -5098,7 +5098,7 @@ get_id_list (
*/ */
count = 0; count = 0;
do { do {
for (end = p; *end && !vim_iswhite(*end) && *end != ','; ++end) for (end = p; *end && !ascii_iswhite(*end) && *end != ','; ++end)
; ;
name = xmalloc((int)(end - p + 3)); /* leave room for "^$" */ name = xmalloc((int)(end - p + 3)); /* leave room for "^$" */
STRLCPY(name + 1, p, end - p + 1); STRLCPY(name + 1, p, end - p + 1);
@ -6143,7 +6143,7 @@ do_highlight (
* Isolate the key ("term", "ctermfg", "ctermbg", "font", "guifg" or * Isolate the key ("term", "ctermfg", "ctermbg", "font", "guifg" or
* "guibg"). * "guibg").
*/ */
while (*linep && !vim_iswhite(*linep) && *linep != '=') while (*linep && !ascii_iswhite(*linep) && *linep != '=')
++linep; ++linep;
xfree(key); xfree(key);
key = vim_strnsave_up(key_start, (int)(linep - key_start)); key = vim_strnsave_up(key_start, (int)(linep - key_start));
@ -7139,7 +7139,7 @@ int highlight_changed(void)
attr = 0; attr = 0;
bool colon = false; bool colon = false;
for (; *p && *p != ','; ++p) { /* parse upto comma */ for (; *p && *p != ','; ++p) { /* parse upto comma */
if (vim_iswhite(*p)) /* ignore white space */ if (ascii_iswhite(*p)) /* ignore white space */
continue; continue;
if (colon) /* Combination with ':' is not allowed. */ if (colon) /* Combination with ':' is not allowed. */

View File

@ -2820,7 +2820,7 @@ int get_tags(list_T *list, char_u *pat)
else if (STRNCMP(p, "file:", 5) == 0) else if (STRNCMP(p, "file:", 5) == 0)
/* skip "file:" (static tag) */ /* skip "file:" (static tag) */
p += 4; p += 4;
else if (!vim_iswhite(*p)) { else if (!ascii_iswhite(*p)) {
char_u *s, *n; char_u *s, *n;
int len; int len;

View File

@ -328,12 +328,6 @@ enum {
#define hl_attr(n) highlight_attr[(int)(n)] #define hl_attr(n) highlight_attr[(int)(n)]
#define term_str(n) term_strings[(int)(n)] #define term_str(n) term_strings[(int)(n)]
/*
* vim_iswhite() is used for "^" and the like. It differs from isspace()
* because it doesn't include <CR> and <LF> and the like.
*/
#define vim_iswhite(x) ((x) == ' ' || (x) == '\t')
/* Maximum number of bytes in a multi-byte character. It can be one 32-bit /* Maximum number of bytes in a multi-byte character. It can be one 32-bit
* character of up to 6 bytes, or one 16-bit character of up to three bytes * character of up to 6 bytes, or one 16-bit character of up to three bytes
* plus six following composing characters of three bytes each. */ * plus six following composing characters of three bytes each. */