compl_cont_status = 0;
compl_started = FALSE;
compl_matches = 0;
+ compl_selected_item = -1;
compl_ins_end_col = 0;
VIM_CLEAR_STRING(compl_pattern);
VIM_CLEAR_STRING(compl_leader);
{
int retval = FALSE;
int prev_mode = ctrl_x_mode;
+ int handle_enter = FALSE;
+
+ if ((c == CAR || c == NL || c == K_KENTER) && compl_selected_item == -1)
+ handle_enter = TRUE;
// Forget any previous 'special' messages if this is actually
// a ^X mode key - bar ^R, in which case we wait to see what it gives us.
if ((ctrl_x_mode_normal() && c != Ctrl_N && c != Ctrl_P
&& c != Ctrl_R && !ins_compl_pum_key(c))
|| ctrl_x_mode == CTRL_X_FINISHED)
+ {
retval = ins_compl_stop(c, prev_mode, retval);
+ // When it is the Enter key and no selected item, return false, and
+ // continue processing the Enter key to insert a new line in the
+ // edit function.
+ if (retval && handle_enter)
+ retval = FALSE;
+ }
}
else if (ctrl_x_mode == CTRL_X_LOCAL_MSG)
// Trigger the CompleteDone event to give scripts a chance to act
endif
endfu
au InsertCharPre <buffer> :call DoIt()
- call feedkeys("A\<f5>\<c-p>u\<cr>\<c-l>\<cr>", 'tx')
+ call feedkeys("A\<f5>\<c-p>u\<C-Y>\<c-l>\<cr>", 'tx')
call assert_equal(["Jan\<c-l>",''], 1->getline('$'))
%d
call setline(1, 'J')
call assert_equal([include, 'two', ''], getline(1, '$'))
call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<cr>\<esc>", 'tnix')
call assert_equal([include, 'three', ''], getline(1, '$'))
- call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
+ call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<C-y>\<esc>", 'tnix')
call assert_equal([include, '', ''], getline(1, '$'))
bw!
endfunc
%d
call setline(1, 'A')
call cursor(1, 1)
- call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
+ call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<C-Y>\<esc>", 'tnix')
call assert_equal(['A'], getline(1, '$'))
%d
call setline(1, 'A')
set smarttab&
endfunc
+func Test_edit_CAR()
+ set cot=menu,menuone,noselect
+ new
+
+ call feedkeys("Shello hero\<CR>h\<C-x>\<C-N>e\<CR>", 'tx')
+ call assert_equal(['hello hero', 'he', ''], getline(1, '$'))
+
+ bw!
+ set cot&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
call setline(1, ['Text', 'ToText', ''])
call cursor(3, 1)
call feedkeys("STe\<C-X>\<C-N>x\<CR>\<Esc>0", 'tx!')
- call assert_equal('Tex', getline('.'))
+ call assert_equal('Tex', getline(line('.') - 1))
" test case for nosort option
set cot=menuone,menu,noinsert,fuzzy,nosort
call setline(1, ['Post', 'Port', 'Po'])
let expected=['Post', 'Port', 'Port']
call cursor(3,2)
- call feedkeys("A\<C-X>". repeat("\<C-P>", 3). "rt\<cr>", 'tx')
+ call feedkeys("A\<C-X>". repeat("\<C-P>", 3). "rt\<C-Y>", 'tx')
call assert_equal(expected, getline(1,'$'))
bwipe!
endfunc
call setline(1, ['Post', 'Port', 'Po'])
let expected=['Post', 'Port', 'Port']
call cursor(3,2)
- call feedkeys("A\<C-P>\<C-N>rt\<cr>", 'tx')
+ call feedkeys("A\<C-P>\<C-N>rt\<C-Y>", 'tx')
call assert_equal(expected, getline(1,'$'))
bwipe!
endfunc
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1121,
/**/
1120,
/**/