Factor out skip_colon_white()

This commit is contained in:
Rob Pilling 2019-03-08 22:49:03 +00:00
parent d4384cbbf3
commit 3b3d217754

View File

@ -1201,6 +1201,19 @@ static void get_wincmd_addr_type(char_u *arg, exarg_T *eap)
} }
} }
static char_u *skip_colon_white(const char_u *p, bool skipleadingwhite)
{
if (skipleadingwhite) {
p = skipwhite(p);
}
while (*p == ':') {
p = skipwhite(p + 1);
}
return (char_u *)p;
}
/* /*
* Execute one Ex command. * Execute one Ex command.
* *
@ -1705,9 +1718,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
/* /*
* Skip ':' and any white space * Skip ':' and any white space
*/ */
ea.cmd = skipwhite(ea.cmd); ea.cmd = skip_colon_white(ea.cmd, true);
while (*ea.cmd == ':')
ea.cmd = skipwhite(ea.cmd + 1);
/* /*
* If we got a line, but no command, then go to the line. * If we got a line, but no command, then go to the line.
@ -3580,9 +3591,8 @@ char_u *skip_range(
++cmd; ++cmd;
} }
/* Skip ":" and white space. */ // Skip ":" and white space.
while (*cmd == ':') cmd = skip_colon_white(cmd, false);
cmd = skipwhite(cmd + 1);
return (char_u *)cmd; return (char_u *)cmd;
} }