diff src/evalfunc.c @ 14422:06316dbd66bc v8.1.0225

patch 8.1.0225: mode() does not indicate using CTRL-O from Insert mode commit https://github.com/vim/vim/commit/612cc3888b136e80485132d9f997ed457dbc5501 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 29 15:34:26 2018 +0200 patch 8.1.0225: mode() does not indicate using CTRL-O from Insert mode Problem: Mode() does not indicate using CTRL-O from Insert mode. Solution: Add "niI", "niR" and "niV" to mode() result. (closes https://github.com/vim/vim/issues/3000)
author Christian Brabandt <cb@256bit.org>
date Sun, 29 Jul 2018 15:45:05 +0200
parents 631344964949
children 0a69e6e708f9
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -8366,10 +8366,9 @@ f_mkdir(typval_T *argvars, typval_T *ret
     static void
 f_mode(typval_T *argvars, typval_T *rettv)
 {
-    char_u	buf[3];
-
-    buf[1] = NUL;
-    buf[2] = NUL;
+    char_u	buf[4];
+
+    vim_memset(buf, 0, sizeof(buf));
 
     if (time_for_testing == 93784)
     {
@@ -8435,6 +8434,12 @@ f_mode(typval_T *argvars, typval_T *rett
 	buf[0] = 'n';
 	if (finish_op)
 	    buf[1] = 'o';
+	else if (restart_edit == 'I' || restart_edit == 'R'
+							|| restart_edit == 'V')
+	{
+	    buf[1] = 'i';
+	    buf[2] = restart_edit;
+	}
     }
 
     /* Clear out the minor mode when the argument is not a non-zero number or