Hi Bram,

The mode(1) function currently returns "ic" after pressing CTRL-X CTRL-L
instead of "ix". The attached patch fixes this. I have also updated the
test case with some comments.

- Yegappan

-- 
-- 
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.
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 5671cf0..406f01a 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -7789,10 +7789,10 @@ f_mode(typval_T *argvars, typval_T *rettv)
            else
                buf[0] = 'i';
 #ifdef FEAT_INS_EXPAND
-           if (ins_compl_active())
-               buf[1] = 'c';
-           else if (ctrl_x_mode == 1)
+           if (ctrl_x_mode != 0)
                buf[1] = 'x';
+           else if (ins_compl_active())
+               buf[1] = 'c';
 #endif
        }
     }
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index e2dcb4f..4167d1b 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -320,39 +320,73 @@ func! Test_mode()
   normal! 3G
   exe "normal i\<F2>\<Esc>"
   call assert_equal('i-i', g:current_modes)
+  " i_CTRL-P: Multiple matches
   exe "normal i\<C-G>uBa\<C-P>\<F2>\<Esc>u"
   call assert_equal('i-ic', g:current_modes)
+  " i_CTRL-P: Single match
   exe "normal iBro\<C-P>\<F2>\<Esc>u"
   call assert_equal('i-ic', g:current_modes)
+  " i_CTRL-X
   exe "normal iBa\<C-X>\<F2>\<Esc>u"
   call assert_equal('i-ix', g:current_modes)
+  " i_CTRL-X CTRL-P: Multiple matches
   exe "normal iBa\<C-X>\<C-P>\<F2>\<Esc>u"
   call assert_equal('i-ic', g:current_modes)
+  " i_CTRL-X CTRL-P: Single match
   exe "normal iBro\<C-X>\<C-P>\<F2>\<Esc>u"
   call assert_equal('i-ic', g:current_modes)
+  " i_CTRL-X CTRL-P + CTRL-P: Single match
   exe "normal iBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
   call assert_equal('i-ic', g:current_modes)
+  " i_CTRL-X CTRL-L: Multiple matches
+  exe "normal i\<C-X>\<C-L>\<F2>\<Esc>u"
+  call assert_equal('i-ix', g:current_modes)
+  " i_CTRL-X CTRL-L: Single match
+  exe "normal iBlu\<C-X>\<C-L>\<F2>\<Esc>u"
+  call assert_equal('i-ix', g:current_modes)
+  " i_CTRL-P: No match
   exe "normal iCom\<C-P>\<F2>\<Esc>u"
   call assert_equal('i-ic', g:current_modes)
+  " i_CTRL-X CTRL-P: No match
   exe "normal iCom\<C-X>\<C-P>\<F2>\<Esc>u"
   call assert_equal('i-ic', g:current_modes)
+  " i_CTRL-X CTRL-L: No match
+  exe "normal iabc\<C-X>\<C-L>\<F2>\<Esc>u"
+  call assert_equal('i-ix', g:current_modes)
 
+  " R_CTRL-P: Multiple matches
   exe "normal RBa\<C-P>\<F2>\<Esc>u"
   call assert_equal('R-Rc', g:current_modes)
+  " R_CTRL-P: Single match
   exe "normal RBro\<C-P>\<F2>\<Esc>u"
   call assert_equal('R-Rc', g:current_modes)
+  " R_CTRL-X
   exe "normal RBa\<C-X>\<F2>\<Esc>u"
   call assert_equal('R-Rx', g:current_modes)
+  " R_CTRL-X CTRL-P: Multiple matches
   exe "normal RBa\<C-X>\<C-P>\<F2>\<Esc>u"
   call assert_equal('R-Rc', g:current_modes)
+  " R_CTRL-X CTRL-P: Single match
   exe "normal RBro\<C-X>\<C-P>\<F2>\<Esc>u"
   call assert_equal('R-Rc', g:current_modes)
+  " R_CTRL-X CTRL-P + CTRL-P: Single match
   exe "normal RBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
   call assert_equal('R-Rc', g:current_modes)
+  " R_CTRL-X CTRL-L: Multiple matches
+  exe "normal R\<C-X>\<C-L>\<F2>\<Esc>u"
+  call assert_equal('R-Rx', g:current_modes)
+  " R_CTRL-X CTRL-L: Single match
+  exe "normal RBlu\<C-X>\<C-L>\<F2>\<Esc>u"
+  call assert_equal('R-Rx', g:current_modes)
+  " R_CTRL-P: No match
   exe "normal RCom\<C-P>\<F2>\<Esc>u"
   call assert_equal('R-Rc', g:current_modes)
+  " R_CTRL-X CTRL-P: No match
   exe "normal RCom\<C-X>\<C-P>\<F2>\<Esc>u"
   call assert_equal('R-Rc', g:current_modes)
+  " R_CTRL-X CTRL-L: No match
+  exe "normal Rabc\<C-X>\<C-L>\<F2>\<Esc>u"
+  call assert_equal('R-Rx', g:current_modes)
 
   call assert_equal('n', mode(0))
   call assert_equal('n', mode(1))

Raspunde prin e-mail lui