mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 09:18:19 +00:00
coverity/161194: Restore check for 'keywordprg' being ":help"
998d0ffc09
removed the explicit check for ":help", relying instead on whether the user was in a help buffer. However, this breaks escaping the identifier for use in the lookup command.2f54d6927c
tried to fix this by removing "!kp_ex" in "if (cmdchar == 'K' && !kp_ex)", but that causes shell escaping to be used instead of escaping for tag lookup.
This commit is contained in:
@@ -4670,6 +4670,7 @@ static void nv_ident(cmdarg_T *cap)
|
||||
char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp; // 'keywordprg'
|
||||
assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty.
|
||||
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
|
||||
bool kp_help = (STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0);
|
||||
size_t buf_size = n * 2 + 30 + STRLEN(kp);
|
||||
char *buf = xmalloc(buf_size);
|
||||
buf[0] = NUL;
|
||||
@@ -4692,7 +4693,9 @@ static void nv_ident(cmdarg_T *cap)
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
if (kp_ex) {
|
||||
if (kp_help) {
|
||||
STRCPY(buf, "he! ");
|
||||
} else if (kp_ex) {
|
||||
if (cap->count0 != 0) { // Send the count to the ex command.
|
||||
snprintf(buf, buf_size, "%" PRId64, (int64_t)(cap->count0));
|
||||
}
|
||||
@@ -4755,7 +4758,7 @@ static void nv_ident(cmdarg_T *cap)
|
||||
}
|
||||
|
||||
// Now grab the chars in the identifier
|
||||
if (cmdchar == 'K') {
|
||||
if (cmdchar == 'K' && !kp_help) {
|
||||
ptr = vim_strnsave(ptr, n);
|
||||
if (kp_ex) {
|
||||
// Escape the argument properly for an Ex command
|
||||
|
Reference in New Issue
Block a user