mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(keywordprg): default to :help if set to empty string (#19983)
This commit is contained in:
parent
88c32b5eba
commit
b21980bd60
@ -4278,13 +4278,12 @@ static void nv_ident(cmdarg_T *cap)
|
|||||||
// double the length of the word. p_kp / curbuf->b_p_kp could be added
|
// double the length of the word. p_kp / curbuf->b_p_kp could be added
|
||||||
// and some numbers.
|
// and some numbers.
|
||||||
char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : (char_u *)curbuf->b_p_kp; // 'keywordprg'
|
char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : (char_u *)curbuf->b_p_kp; // 'keywordprg'
|
||||||
assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty.
|
bool kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0);
|
||||||
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
|
|
||||||
bool kp_help = (STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0);
|
|
||||||
if (kp_help && *skipwhite(ptr) == NUL) {
|
if (kp_help && *skipwhite(ptr) == NUL) {
|
||||||
emsg(_(e_noident)); // found white space only
|
emsg(_(e_noident)); // found white space only
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
|
||||||
size_t buf_size = n * 2 + 30 + STRLEN(kp);
|
size_t buf_size = n * 2 + 30 + STRLEN(kp);
|
||||||
char *buf = xmalloc(buf_size);
|
char *buf = xmalloc(buf_size);
|
||||||
buf[0] = NUL;
|
buf[0] = NUL;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local eq, clear, eval, feed, retry =
|
local eq, clear, eval, feed, meths, retry =
|
||||||
helpers.eq, helpers.clear, helpers.eval, helpers.feed, helpers.retry
|
helpers.eq, helpers.clear, helpers.eval, helpers.feed, helpers.meths, helpers.retry
|
||||||
|
|
||||||
describe('K', function()
|
describe('K', function()
|
||||||
local test_file = 'K_spec_out'
|
local test_file = 'K_spec_out'
|
||||||
@ -58,4 +58,11 @@ describe('K', function()
|
|||||||
helpers.neq(bufnr, eval('bufnr()'))
|
helpers.neq(bufnr, eval('bufnr()'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('empty string falls back to :help #19298', function()
|
||||||
|
meths.set_option('keywordprg', '')
|
||||||
|
meths.buf_set_lines(0, 0, -1, true, {'doesnotexist'})
|
||||||
|
feed('K')
|
||||||
|
eq('E149: Sorry, no help for doesnotexist', meths.get_vvar('errmsg'))
|
||||||
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user