vim-patch:9.0.2133: Cannot detect overstrike mode in Cmdline mode (#26263)

Problem:  Cannot detect overstrike mode in Cmdline mode
Solution: Make mode() return "cr" for overstrike

closes: vim/vim#13569

d1c3ef1f47
This commit is contained in:
zeertzjq
2023-11-28 11:46:20 +08:00
committed by GitHub
parent 1a8f60c7d2
commit e6d38c7dac
7 changed files with 55 additions and 1 deletions

View File

@@ -7038,7 +7038,9 @@ M.funcs = {
Rvc Virtual Replace mode completion |compl-generic|
Rvx Virtual Replace mode |i_CTRL-X| completion
c Command-line editing
cr Command-line while in overstrike mode |c_<Insert>|
cv Vim Ex mode |gQ|
cvr Vim Ex while in overstrike mode |c_<Insert>|
r Hit-enter prompt
rm The -- more -- prompt
r? A |:confirm| query of some sort

View File

@@ -1835,8 +1835,10 @@ static int command_line_handle_key(CommandLineState *s)
case K_INS:
case K_KINS:
ccline.overstrike = !ccline.overstrike;
ui_cursor_shape(); // may show different cursor shape
may_trigger_modechanged();
status_redraw_curbuf();
redraw_statuslines();
return command_line_not_changed(s);
case Ctrl_HAT:

View File

@@ -8,6 +8,7 @@
#include "nvim/eval/typval.h"
#include "nvim/event/defs.h"
#include "nvim/event/multiqueue.h"
#include "nvim/ex_getln.h"
#include "nvim/getchar.h"
#include "nvim/globals.h"
#include "nvim/insexpand.h"
@@ -210,6 +211,9 @@ void get_mode(char *buf)
if (exmode_active) {
buf[i++] = 'v';
}
if ((State & MODE_CMDLINE) && cmdline_overstrike()) {
buf[i++] = 'r';
}
} else if (State & MODE_TERMINAL) {
buf[i++] = 't';
} else {