Hi,

On Fri, Jan 20, 2017 at 12:35 PM, Zhen-Huan (Kenny) Hu
<[email protected]> wrote:
> diff --git a/src/evalfunc.c b/src/evalfunc.c
> index 4b6bfaa..1f3164f 100644
> --- a/src/evalfunc.c
> +++ b/src/evalfunc.c
> @@ -7765,10 +7765,16 @@ f_mode(typval_T *argvars, typval_T *rettv)
>   }
>   else
>  #endif
> - if (State & REPLACE_FLAG)
> -    buf[0] = 'R';
> - else
> -    buf[0] = 'i';
> + {
> +    if (State & REPLACE_FLAG)
> + buf[0] = 'R';
> +    else
> + buf[0] = 'i';
> +#ifdef FEAT_INS_EXPAND
> +    if (ctrl_x_mode != 0)
> + buf[1] = 'x';
> +#endif
> + }
>      }
>      else if (State & CMDLINE)
>      {
>
> I tested CTRL-X under both replace mode and insert mode. Under replace mode,
> mode(1) returns Rx and under insert mode, it returns ix.
>
> As a side note, why CTRL-N/P and CTRL-X + CTRL-N/P behave differently than
> CTRL-X + others. It seems if CTRL-N/P cannot find a match, it will
> automatically return to the insert mode. If CTRL-X + others cannot find a
> match, it will stay under CTRL-X mode?
>

Based on the patch from Hirohito, I have adjusted the patch to handle
this case. Try using the attached patch.

- 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 4b6bfaa..76d36f7 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -7765,10 +7765,18 @@ f_mode(typval_T *argvars, typval_T *rettv)
        }
        else
 #endif
-       if (State & REPLACE_FLAG)
-           buf[0] = 'R';
-       else
-           buf[0] = 'i';
+       {
+           if (State & REPLACE_FLAG)
+               buf[0] = 'R';
+           else
+               buf[0] = 'i';
+#ifdef FEAT_INS_EXPAND
+           if (ctrl_x_mode != 0)
+               buf[1] = 'x';
+           else if (ins_compl_active())
+               buf[1] = pum_visible() ? 'C' : 'c';
+#endif
+       }
     }
     else if (State & CMDLINE)
     {

Raspunde prin e-mail lui