1
0
forked from aniani/vim

patch 8.2.3629: command completion in cmdline window uses global commands

Problem:    Command completion in cmdline window uses global user commands,
            not local commands for the window where it was opened from.
Solution:   Use local commands. (closes #9168)
This commit is contained in:
mityu
2021-11-20 19:13:39 +00:00
committed by Bram Moolenaar
parent 87fd0924e2
commit a119812437
6 changed files with 73 additions and 12 deletions

View File

@@ -141,7 +141,11 @@ find_ucmd(
/*
* Look for buffer-local user commands first, then global ones.
*/
gap = &curbuf->b_ucmds;
gap =
#ifdef FEAT_CMDWIN
is_in_cmdwin() ? &prevwin->w_buffer->b_ucmds :
#endif
&curbuf->b_ucmds;
for (;;)
{
for (j = 0; j < gap->ga_len; ++j)
@@ -303,7 +307,7 @@ get_user_commands(expand_T *xp UNUSED, int idx)
// In cmdwin, the alternative buffer should be used.
buf_T *buf =
#ifdef FEAT_CMDWIN
(cmdwin_type != 0 && get_cmdline_type() == NUL) ? prevwin->w_buffer :
is_in_cmdwin() ? prevwin->w_buffer :
#endif
curbuf;
@@ -330,10 +334,9 @@ get_user_command_name(int idx, int cmdidx)
// In cmdwin, the alternative buffer should be used.
buf_T *buf =
#ifdef FEAT_CMDWIN
(cmdwin_type != 0 && get_cmdline_type() == NUL)
? prevwin->w_buffer :
is_in_cmdwin() ? prevwin->w_buffer :
#endif
curbuf;
curbuf;
if (idx < buf->b_ucmds.ga_len)
return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
@@ -420,10 +423,9 @@ uc_list(char_u *name, size_t name_len)
// In cmdwin, the alternative buffer should be used.
gap =
#ifdef FEAT_CMDWIN
(cmdwin_type != 0 && get_cmdline_type() == NUL) ?
&prevwin->w_buffer->b_ucmds :
is_in_cmdwin() ? &prevwin->w_buffer->b_ucmds :
#endif
&curbuf->b_ucmds;
&curbuf->b_ucmds;
for (;;)
{
for (i = 0; i < gap->ga_len; ++i)