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.
333b80acf3
This commit is contained in:
Jan Edmund Lazo
2020-02-16 08:34:48 -05:00
parent 7955c05acc
commit 18d86283b0
5 changed files with 55 additions and 37 deletions

View File

@@ -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;