diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-02-16 08:34:48 -0500 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-02-16 09:38:14 -0500 |
commit | 18d86283b04c42f331da23b61e09ae0039825143 (patch) | |
tree | 2565b7557f0baba5b63cd5dba56c3a7d3efdc872 /src/nvim/ex_docmd.c | |
parent | 7955c05accaac452c1350d08af62d9d75387f24f (diff) | |
download | rneovim-18d86283b04c42f331da23b61e09ae0039825143.tar.gz rneovim-18d86283b04c42f331da23b61e09ae0039825143.tar.bz2 rneovim-18d86283b04c42f331da23b61e09ae0039825143.zip |
vim-patch:8.0.1660: the terminal API "drop" command doesn't support options
Problem: The terminal API "drop" command doesn't support options.
Solution: Implement the options.
https://github.com/vim/vim/commit/333b80acf3a44e462456e6d5730e47ffa449c83d
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index b8b98c4f0d..ead0922c5a 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -4538,6 +4538,19 @@ skip_cmd_arg ( return p; } +int get_bad_opt(const char_u *p, exarg_T *eap) + FUNC_ATTR_NONNULL_ALL +{ + if (STRICMP(p, "keep") == 0) { + eap->bad_char = BAD_KEEP; + } else if (STRICMP(p, "drop") == 0) { + eap->bad_char = BAD_DROP; + } else if (MB_BYTE2LEN(*p) == 1 && p[1] == NUL) { + eap->bad_char = *p; + } + return FAIL; +} + /* * Get "++opt=arg" argument. * Return FAIL or OK. @@ -4596,8 +4609,10 @@ static int getargopt(exarg_T *eap) *arg = NUL; if (pp == &eap->force_ff) { - if (check_ff_value(eap->cmd + eap->force_ff) == FAIL) + if (check_ff_value(eap->cmd + eap->force_ff) == FAIL) { return FAIL; + } + eap->force_ff = eap->cmd[eap->force_ff]; } else if (pp == &eap->force_enc) { /* Make 'fileencoding' lower case. */ for (p = eap->cmd + eap->force_enc; *p != NUL; ++p) @@ -4605,15 +4620,9 @@ static int getargopt(exarg_T *eap) } else { /* Check ++bad= argument. Must be a single-byte character, "keep" or * "drop". */ - p = eap->cmd + bad_char_idx; - if (STRICMP(p, "keep") == 0) - eap->bad_char = BAD_KEEP; - else if (STRICMP(p, "drop") == 0) - eap->bad_char = BAD_DROP; - else if (MB_BYTE2LEN(*p) == 1 && p[1] == NUL) - eap->bad_char = *p; - else + if (get_bad_opt(eap->cmd + bad_char_idx, eap) == FAIL) { return FAIL; + } } return OK; |