Hi Bram, Yegappan, Zhen and Vim developers, 2017-1-20(Fri) 12:44:50 UTC+9 vim-dev ML: > Hi, > > > > On Thu, Jan 19, 2017 at 3:56 PM, Zhen-Huan (Kenny) Hu > > <vim-dev...@256bit.org> wrote: > > > #ifdef FEAT_INS_EXPAND > > > if (ctrl_x_mode != 0) > > > buf[0] = 'x'; > > > else > > > #endif > > > > > > I tested the code. mode() all returns x as expected when pressing <C-x> > > > alone, or combined with <C-d>, <C-f>, <C-i>, <C-v>, <C-l>, <C-s>, <C-o>, as > > > well as <C-e>, <C-y> > > > > > > Pressing <C-x><C-n> or <C-x><C-p>, mode() returns i. > > > > > > I agree it should be ix since it's a sub-mode. > > > > > > > An updated patch to return either "ix" or "Rx" is attached. [...]
How about attached patch? -- Best regards, Hirohito Higashi (a.k.a. h_east) -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index ec4030e..ce1dbb5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5839,6 +5839,9 @@ mode([expr]) Return a string that indicates the current mode. S Select by line CTRL-S Select blockwise i Insert + ic Insert completion + iC Insert completion with displaying popup menu + ix Insert CTRL-X mode selecting R Replace |R| Rv Virtual Replace |gR| c Command-line diff --git a/src/evalfunc.c b/src/evalfunc.c index 4b6bfaa..c618c41 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -7768,7 +7768,15 @@ f_mode(typval_T *argvars, typval_T *rettv) if (State & REPLACE_FLAG) buf[0] = 'R'; else + { buf[0] = 'i'; +#ifdef FEAT_INS_EXPAND + if (ins_compl_active()) + buf[1] = pum_visible() ? 'C' : 'c'; + else if (ctrl_x_mode == 1) + buf[1] = 'x'; +#endif + } } else if (State & CMDLINE) {