Patch 7.4.2331
Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode
does not work after entering an expression on the command line.
Solution: Don't use "ccline" when not actually using a command line. (test
by Hirohito Higashi)
Files: src/edit.c, src/ex_getln.c, src/proto/ex_getln.pro,
src/testdir/test_popup.vim
*** ../vim-7.4.2330/src/edit.c 2016-08-29 22:48:12.121106421 +0200
--- src/edit.c 2016-09-05 20:53:05.025082101 +0200
***************
*** 5304,5310 ****
if (compl_pattern == NULL)
return FAIL;
set_cmd_context(&compl_xp, compl_pattern,
! (int)STRLEN(compl_pattern), curs_col);
if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
|| compl_xp.xp_context == EXPAND_NOTHING)
/* No completion possible, use an empty pattern to get a
--- 5304,5310 ----
if (compl_pattern == NULL)
return FAIL;
set_cmd_context(&compl_xp, compl_pattern,
! (int)STRLEN(compl_pattern), curs_col, FALSE);
if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
|| compl_xp.xp_context == EXPAND_NOTHING)
/* No completion possible, use an empty pattern to get a
*** ../vim-7.4.2330/src/ex_getln.c 2016-09-03 21:04:54.989247387 +0200
--- src/ex_getln.c 2016-09-05 20:56:00.343600510 +0200
***************
*** 4509,4515 ****
xp->xp_context = EXPAND_NOTHING;
return;
}
! set_cmd_context(xp, ccline.cmdbuff, ccline.cmdlen, ccline.cmdpos);
}
void
--- 4509,4515 ----
xp->xp_context = EXPAND_NOTHING;
return;
}
! set_cmd_context(xp, ccline.cmdbuff, ccline.cmdlen, ccline.cmdpos, TRUE);
}
void
***************
*** 4517,4523 ****
expand_T *xp,
char_u *str, /* start of command line */
int len, /* length of command line (excl. NUL) */
! int col) /* position of cursor */
{
int old_char = NUL;
char_u *nextcomm;
--- 4517,4524 ----
expand_T *xp,
char_u *str, /* start of command line */
int len, /* length of command line (excl. NUL) */
! int col, /* position of cursor */
! int use_ccline UNUSED) /* use ccline for info */
{
int old_char = NUL;
char_u *nextcomm;
***************
*** 4532,4545 ****
nextcomm = str;
#ifdef FEAT_EVAL
! if (ccline.cmdfirstc == '=')
{
# ifdef FEAT_CMDL_COMPL
/* pass CMD_SIZE because there is no real command */
set_context_for_expression(xp, str, CMD_SIZE);
# endif
}
! else if (ccline.input_fn)
{
xp->xp_context = ccline.xp_context;
xp->xp_pattern = ccline.cmdbuff;
--- 4533,4546 ----
nextcomm = str;
#ifdef FEAT_EVAL
! if (use_ccline && ccline.cmdfirstc == '=')
{
# ifdef FEAT_CMDL_COMPL
/* pass CMD_SIZE because there is no real command */
set_context_for_expression(xp, str, CMD_SIZE);
# endif
}
! else if (use_ccline && ccline.input_fn)
{
xp->xp_context = ccline.xp_context;
xp->xp_pattern = ccline.cmdbuff;
*** ../vim-7.4.2330/src/proto/ex_getln.pro 2016-09-03 16:29:01.450841139
+0200
--- src/proto/ex_getln.pro 2016-09-05 20:54:23.392419815 +0200
***************
*** 30,36 ****
void tilde_replace(char_u *orig_pat, int num_files, char_u **files);
char_u *sm_gettail(char_u *s);
char_u *addstar(char_u *fname, int len, int context);
! void set_cmd_context(expand_T *xp, char_u *str, int len, int col);
int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount,
char_u ***matches);
int ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u
***file, char_u *((*func)(expand_T *, int)), int escaped);
void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options);
--- 30,36 ----
void tilde_replace(char_u *orig_pat, int num_files, char_u **files);
char_u *sm_gettail(char_u *s);
char_u *addstar(char_u *fname, int len, int context);
! void set_cmd_context(expand_T *xp, char_u *str, int len, int col, int
use_ccline);
int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount,
char_u ***matches);
int ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u
***file, char_u *((*func)(expand_T *, int)), int escaped);
void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options);
*** ../vim-7.4.2330/src/testdir/test_popup.vim 2016-09-03 22:35:02.396409822
+0200
--- src/testdir/test_popup.vim 2016-09-05 20:52:36.909316640 +0200
***************
*** 242,263 ****
iunmap <F5>
endfunc
- function! ComplTest() abort
- call complete(1, ['source', 'soundfold'])
- return ''
- endfunction
-
func Test_noinsert_complete()
new
set completeopt+=noinsert
! inoremap <F5> <C-R>=ComplTest()<CR>
call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx')
call assert_equal('soundfold', getline(1))
call assert_equal('soundfold', getline(2))
bwipe!
new
! inoremap <F5> <C-R>=Test()<CR>
call feedkeys("i\<F5>\<CR>\<ESC>", 'tx')
call assert_equal('source', getline(1))
bwipe!
--- 242,268 ----
iunmap <F5>
endfunc
func Test_noinsert_complete()
+ function! s:complTest1() abort
+ call complete(1, ['source', 'soundfold'])
+ return ''
+ endfunction
+
+ function! s:complTest2() abort
+ call complete(1, ['source', 'soundfold'])
+ return ''
+ endfunction
+
new
set completeopt+=noinsert
! inoremap <F5> <C-R>=s:complTest1()<CR>
call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx')
call assert_equal('soundfold', getline(1))
call assert_equal('soundfold', getline(2))
bwipe!
new
! inoremap <F5> <C-R>=s:complTest2()<CR>
call feedkeys("i\<F5>\<CR>\<ESC>", 'tx')
call assert_equal('source', getline(1))
bwipe!
***************
*** 266,275 ****
iunmap <F5>
endfunc
! function! Test() abort
! call complete(1, ['source', 'soundfold'])
! return ''
! endfunction
" vim: shiftwidth=2 sts=2 expandtab
--- 271,290 ----
iunmap <F5>
endfunc
+ func Test_compl_vim_cmds_after_register_expr()
+ function! s:test_func()
+ return 'autocmd '
+ endfunction
+ augroup AAAAA_Group
+ au!
+ augroup END
! new
! call feedkeys("i\<c-r>=s:test_func()\<CR>\<C-x>\<C-v>\<Esc>", 'tx')
! call assert_equal('autocmd AAAAA_Group', getline(1))
! autocmd! AAAAA_Group
! augroup! AAAAA_Group
! bwipe!
! endfunc
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-7.4.2330/src/version.c 2016-09-04 23:41:36.973433429 +0200
--- src/version.c 2016-09-05 20:56:08.195534192 +0200
***************
*** 765,766 ****
--- 765,768 ----
{ /* Add new patch number below this line */
+ /**/
+ 2331,
/**/
--
hundred-and-one symptoms of being an internet addict:
172. You join listservers just for the extra e-mail.
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.