To: vim_dev@googlegroups.com Subject: Patch 8.2.1901 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1901 Problem: Variable completion does not work in command line window. Solution: Use the "prevwin". (closes #7198) Files: src/evalvars.c, src/testdir/test_ins_complete.vim *** ../vim-8.2.1900/src/evalvars.c 2020-10-23 18:02:28.711453754 +0200 --- src/evalvars.c 2020-10-25 13:16:38.569200456 +0100 *************** *** 1981,1987 **** } // b: variables ! ht = &curbuf->b_vars->dv_hashtab; if (bdone < ht->ht_used) { if (bdone++ == 0) --- 1981,1993 ---- } // b: variables ! ht = ! #ifdef FEAT_CMDWIN ! // In cmdwin, the alternative buffer should be used. ! (cmdwin_type != 0 && get_cmdline_type() == NUL) ? ! &prevwin->w_buffer->b_vars->dv_hashtab : ! #endif ! &curbuf->b_vars->dv_hashtab; if (bdone < ht->ht_used) { if (bdone++ == 0) *************** *** 1994,2000 **** } // w: variables ! ht = &curwin->w_vars->dv_hashtab; if (wdone < ht->ht_used) { if (wdone++ == 0) --- 2000,2012 ---- } // w: variables ! ht = ! #ifdef FEAT_CMDWIN ! // In cmdwin, the alternative window should be used. ! (cmdwin_type != 0 && get_cmdline_type() == NUL) ? ! &prevwin->w_vars->dv_hashtab : ! #endif ! &curwin->w_vars->dv_hashtab; if (wdone < ht->ht_used) { if (wdone++ == 0) *** ../vim-8.2.1900/src/testdir/test_ins_complete.vim 2020-09-27 20:12:49.417331796 +0200 --- src/testdir/test_ins_complete.vim 2020-10-25 13:16:38.569200456 +0100 *************** *** 346,352 **** --- 346,355 ---- set wildmenu wildchar= com! -nargs=1 -complete=command GetInput let input = com! -buffer TestCommand echo 'TestCommand' + let w:test_winvar = 'winvar' + let b:test_bufvar = 'bufvar' + " User-defined commands let input = '' call feedkeys("q:iGetInput T\\\", 'tx!') call assert_equal('TestCommand', input) *************** *** 355,362 **** --- 358,387 ---- call feedkeys("q::GetInput T\\:q\", 'tx!') call assert_equal('T', input) + + com! -nargs=1 -complete=var GetInput let input = + " Window-local variables + let input = '' + call feedkeys("q:iGetInput w:test_\\\", 'tx!') + call assert_equal('w:test_winvar', input) + + let input = '' + call feedkeys("q::GetInput w:test_\\:q\", 'tx!') + call assert_equal('w:test_', input) + + " Buffer-local variables + let input = '' + call feedkeys("q:iGetInput b:test_\\\", 'tx!') + call assert_equal('b:test_bufvar', input) + + let input = '' + call feedkeys("q::GetInput b:test_\\:q\", 'tx!') + call assert_equal('b:test_', input) + delcom TestCommand delcom GetInput + unlet w:test_winvar + unlet b:test_bufvar set wildmenu& wildchar& endfunc *** ../vim-8.2.1900/src/version.c 2020-10-24 23:08:34.715491609 +0200 --- src/version.c 2020-10-25 13:18:22.120931904 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1901, /**/ -- You cannot have a baby in one month by getting nine women pregnant. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///