diff options
author | Rob Pilling <robpilling@gmail.com> | 2019-03-08 22:49:03 +0000 |
---|---|---|
committer | Rob Pilling <robpilling@gmail.com> | 2019-10-31 19:16:52 +0000 |
commit | 3b3d21775478cc97acf391a30d844eb3a81e96f6 (patch) | |
tree | c772832045597fd6f96bdb35a71f35b758520f7c /src | |
parent | d4384cbbf37786f0185f6bbb2e5bf82f5573e532 (diff) | |
download | rneovim-3b3d21775478cc97acf391a30d844eb3a81e96f6.tar.gz rneovim-3b3d21775478cc97acf391a30d844eb3a81e96f6.tar.bz2 rneovim-3b3d21775478cc97acf391a30d844eb3a81e96f6.zip |
Factor out skip_colon_white()
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_docmd.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index da0184aa45..22c4fd264d 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -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. * @@ -1705,9 +1718,7 @@ static char_u * do_one_cmd(char_u **cmdlinep, /* * Skip ':' and any white space */ - ea.cmd = skipwhite(ea.cmd); - while (*ea.cmd == ':') - ea.cmd = skipwhite(ea.cmd + 1); + ea.cmd = skip_colon_white(ea.cmd, true); /* * If we got a line, but no command, then go to the line. @@ -3580,9 +3591,8 @@ char_u *skip_range( ++cmd; } - /* Skip ":" and white space. */ - while (*cmd == ':') - cmd = skipwhite(cmd + 1); + // Skip ":" and white space. + cmd = skip_colon_white(cmd, false); return (char_u *)cmd; } |