mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.1901: variable completion does not work in command line window
Problem: Variable completion does not work in command line window. Solution: Use the "prevwin". (closes vim/vim#7198)4ff2f2fb6b
N/A patches for version.c: vim-patch:8.2.1899: crash in out-of-memory situation Problem: Crash in out-of-memory situation. Solution: Bail out if shell_name is NULL. (Dominique Pellé, closes vim/vim#7196)67def64a4e
This commit is contained in:
parent
36f78412f9
commit
a868cd920a
@ -2994,7 +2994,6 @@ char_u *get_user_var_name(expand_T *xp, int idx)
|
|||||||
static size_t tdone;
|
static size_t tdone;
|
||||||
static size_t vidx;
|
static size_t vidx;
|
||||||
static hashitem_T *hi;
|
static hashitem_T *hi;
|
||||||
hashtab_T *ht;
|
|
||||||
|
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
gdone = bdone = wdone = vidx = 0;
|
gdone = bdone = wdone = vidx = 0;
|
||||||
@ -3015,7 +3014,10 @@ char_u *get_user_var_name(expand_T *xp, int idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// b: variables
|
// b: variables
|
||||||
ht = &curbuf->b_vars->dv_hashtab;
|
// In cmdwin, the alternative buffer should be used.
|
||||||
|
hashtab_T *ht = (cmdwin_type != 0 && get_cmdline_type() == NUL)
|
||||||
|
? &prevwin->w_buffer->b_vars->dv_hashtab
|
||||||
|
: &curbuf->b_vars->dv_hashtab;
|
||||||
if (bdone < ht->ht_used) {
|
if (bdone < ht->ht_used) {
|
||||||
if (bdone++ == 0)
|
if (bdone++ == 0)
|
||||||
hi = ht->ht_array;
|
hi = ht->ht_array;
|
||||||
@ -3027,7 +3029,10 @@ char_u *get_user_var_name(expand_T *xp, int idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// w: variables
|
// w: variables
|
||||||
ht = &curwin->w_vars->dv_hashtab;
|
// In cmdwin, the alternative window should be used.
|
||||||
|
ht = (cmdwin_type != 0 && get_cmdline_type() == NUL)
|
||||||
|
? &prevwin->w_vars->dv_hashtab
|
||||||
|
: &curwin->w_vars->dv_hashtab;
|
||||||
if (wdone < ht->ht_used) {
|
if (wdone < ht->ht_used) {
|
||||||
if (wdone++ == 0)
|
if (wdone++ == 0)
|
||||||
hi = ht->ht_array;
|
hi = ht->ht_array;
|
||||||
|
@ -327,7 +327,10 @@ func Test_compl_in_cmdwin()
|
|||||||
set wildmenu wildchar=<Tab>
|
set wildmenu wildchar=<Tab>
|
||||||
com! -nargs=1 -complete=command GetInput let input = <q-args>
|
com! -nargs=1 -complete=command GetInput let input = <q-args>
|
||||||
com! -buffer TestCommand echo 'TestCommand'
|
com! -buffer TestCommand echo 'TestCommand'
|
||||||
|
let w:test_winvar = 'winvar'
|
||||||
|
let b:test_bufvar = 'bufvar'
|
||||||
|
|
||||||
|
" User-defined commands
|
||||||
let input = ''
|
let input = ''
|
||||||
call feedkeys("q:iGetInput T\<C-x>\<C-v>\<CR>", 'tx!')
|
call feedkeys("q:iGetInput T\<C-x>\<C-v>\<CR>", 'tx!')
|
||||||
call assert_equal('TestCommand', input)
|
call assert_equal('TestCommand', input)
|
||||||
@ -336,8 +339,29 @@ func Test_compl_in_cmdwin()
|
|||||||
call feedkeys("q::GetInput T\<Tab>\<CR>:q\<CR>", 'tx!')
|
call feedkeys("q::GetInput T\<Tab>\<CR>:q\<CR>", 'tx!')
|
||||||
call assert_equal('T', input)
|
call assert_equal('T', input)
|
||||||
|
|
||||||
|
com! -nargs=1 -complete=var GetInput let input = <q-args>
|
||||||
|
" Window-local variables
|
||||||
|
let input = ''
|
||||||
|
call feedkeys("q:iGetInput w:test_\<C-x>\<C-v>\<CR>", 'tx!')
|
||||||
|
call assert_equal('w:test_winvar', input)
|
||||||
|
|
||||||
|
let input = ''
|
||||||
|
call feedkeys("q::GetInput w:test_\<Tab>\<CR>:q\<CR>", 'tx!')
|
||||||
|
call assert_equal('w:test_', input)
|
||||||
|
|
||||||
|
" Buffer-local variables
|
||||||
|
let input = ''
|
||||||
|
call feedkeys("q:iGetInput b:test_\<C-x>\<C-v>\<CR>", 'tx!')
|
||||||
|
call assert_equal('b:test_bufvar', input)
|
||||||
|
|
||||||
|
let input = ''
|
||||||
|
call feedkeys("q::GetInput b:test_\<Tab>\<CR>:q\<CR>", 'tx!')
|
||||||
|
call assert_equal('b:test_', input)
|
||||||
|
|
||||||
delcom TestCommand
|
delcom TestCommand
|
||||||
delcom GetInput
|
delcom GetInput
|
||||||
|
unlet w:test_winvar
|
||||||
|
unlet b:test_bufvar
|
||||||
set wildmenu& wildchar&
|
set wildmenu& wildchar&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user