patch 9.0.2133: Cannot detect overstrike mode in Cmdline mode

Commit: 
https://github.com/vim/vim/commit/d1c3ef1f47c87d1da056c56564e1985fe6f2931d
Author: Sam-programs <None>
Date:   Mon Nov 27 22:22:51 2023 +0100

    patch 9.0.2133: Cannot detect overstrike mode in Cmdline mode
    
    Problem:  Cannot detect overstrike mode in Cmdline mode
    Solution: Make mode() return "cr" for overstrike
    
    closes: #13569
    
    Signed-off-by: Sam-programs <None>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 96d7a0dd3..f7cc8f88a 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -6413,7 +6413,9 @@ mode([expr])      Return a string that indicates the 
current mode.
                   Rvx      Virtual Replace mode |i_CTRL-X| completion
                   c        Command-line editing
                   ct       Command-line editing via Terminal-Job mode
+                  cr       Command-line while in overstrike mode |c_<Insert>|
                   cv       Vim Ex mode |gQ|
+                  cvr      Vim Ex while in overstrike mode |c_<Insert>|
                   ce       Normal Ex mode |Q|
                   r        Hit-enter prompt
                   rm       The -- more -- prompt
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 8f0be5208..52f4feb3f 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -2050,6 +2050,9 @@ getcmdline_int(
 #ifdef CURSOR_SHAPE
                ui_cursor_shape();      // may show different cursor shape
 #endif
+               may_trigger_modechanged();
+               status_redraw_curbuf();
+               redraw_statuslines();
                goto cmdline_not_changed;
 
        case Ctrl_HAT:
@@ -3169,8 +3172,6 @@ redraw:
     return (char_u *)line_ga.ga_data;
 }
 
-# if defined(MCH_CURSOR_SHAPE) || defined(FEAT_GUI) \
-       || defined(FEAT_MOUSESHAPE) || defined(PROTO)
 /*
  * Return TRUE if ccline.overstrike is on.
  */
@@ -3180,6 +3181,8 @@ cmdline_overstrike(void)
     return ccline.overstrike;
 }
 
+# if defined(MCH_CURSOR_SHAPE) || defined(FEAT_GUI) \
+        || defined(FEAT_MOUSESHAPE) || defined(PROTO)
 /*
  * Return TRUE if the cursor is at the end of the cmdline.
  */
diff --git a/src/misc1.c b/src/misc1.c
index a82ef9cd9..e83ec66f7 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -720,6 +720,8 @@ get_mode(char_u *buf)
            buf[i++] = 'v';
        else if (exmode_active == EXMODE_NORMAL)
            buf[i++] = 'e';
+       if ((State & MODE_CMDLINE) && cmdline_overstrike())
+           buf[i++] = 'r';
     }
     else
     {
diff --git a/src/testdir/dumps/Test_mode_1.dump 
b/src/testdir/dumps/Test_mode_1.dump
new file mode 100644
index 000000000..866ffd566
--- /dev/null
+++ b/src/testdir/dumps/Test_mode_1.dump
@@ -0,0 +1,12 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|c+3#0000000&| @73
+|:+0&&> @73
diff --git a/src/testdir/dumps/Test_mode_2.dump 
b/src/testdir/dumps/Test_mode_2.dump
new file mode 100644
index 000000000..6cbfe2bd5
--- /dev/null
+++ b/src/testdir/dumps/Test_mode_2.dump
@@ -0,0 +1,12 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|c+3#0000000&|r| @72
+|:+0&&> @73
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 0801d2b69..4cde9e40d 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -916,8 +916,12 @@ func Test_mode()
 
   call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt')
   call assert_equal('c-c', g:current_modes)
+  call feedkeys(":\<insert>\<C-r>=Save_mode()\<CR>",'xt')
+  call assert_equal("c-cr", g:current_modes)
   call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt')
   call assert_equal('c-cv', g:current_modes)
+  call feedkeys("gQ\<insert>\<C-r>=Save_mode()\<CR>",'xt')
+  call assert_equal("c-cvr", g:current_modes)
   call feedkeys("Qcall Save_mode()\<CR>vi\<CR>", 'xt')
   call assert_equal('c-ce', g:current_modes)
   " How to test Ex mode?
@@ -935,6 +939,18 @@ func Test_mode()
   call assert_equal('n-niR', g:current_modes)
   execute "normal! gR\<C-o>g@l\<Esc>"
   call assert_equal('n-niV', g:current_modes)
+  " Test statusline updates for overstike mode
+  if CanRunVimInTerminal()
+    let buf = RunVimInTerminal('', {'rows': 12})
+    call term_sendkeys(buf, ":set laststatus=2 statusline=%!mode(1)\<CR>")
+    call term_sendkeys(buf, ":")
+    call TermWait(buf)
+    call VerifyScreenDump(buf, 'Test_mode_1', {})
+    call term_sendkeys(buf, "\<insert>")
+    call TermWait(buf)
+    call VerifyScreenDump(buf, 'Test_mode_2', {})
+    call StopVimInTerminal(buf)
+  endif
 
   if has('terminal')
     term
diff --git a/src/version.c b/src/version.c
index e5cb3c261..4a7cf7d39 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2133,
 /**/
     2132,
 /**/

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1r7jB9-002buM-Fe%40256bit.org.

Raspunde prin e-mail lui