Skip to content

Commit 7a1d328

Browse files
committed
patch 8.2.5109: mode not updated after CTRL-O CTRL-C in Insert mode
Problem: Mode not updated after CTRL-O CTRL-C in Insert mode. Solution: Set redraw_mode and use it. (closes #10581)
1 parent 308660b commit 7a1d328

5 files changed

Lines changed: 28 additions & 3 deletions

File tree

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ main_loop(
14191419
update_screen(0);
14201420
mch_enable_flush();
14211421
}
1422-
else if (redraw_cmdline || clear_cmdline)
1422+
else if (redraw_cmdline || clear_cmdline || redraw_mode)
14231423
showmode();
14241424
redraw_statuslines();
14251425
if (need_maketitle)

src/normal.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6788,6 +6788,9 @@ nv_esc(cmdarg_T *cap)
67886788
msg(_("Type :qa and press <Enter> to exit Vim"));
67896789
}
67906790

6791+
if (restart_edit != 0)
6792+
redraw_mode = TRUE; // remove "-- (insert) --"
6793+
67916794
// Don't reset "restart_edit" when 'insertmode' is set, it won't be
67926795
// set again below when halfway a mapping.
67936796
if (!p_im)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
> +0&#ffffff0@74
2+
|~+0#4040ff13&| @73
3+
|~| @73
4+
|~| @73
5+
| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|

src/testdir/test_normal.vim

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ source shared.vim
44
source check.vim
55
source view_util.vim
66
import './vim9.vim' as v9
7+
source screendump.vim
78

89
func Setup_NewWindow()
910
10new
@@ -2458,9 +2459,9 @@ func Test_normal33_g_cmd2()
24582459
call assert_equal(2, line('.'))
24592460
call assert_fails(':norm! g;', 'E662:')
24602461
call assert_fails(':norm! g,', 'E663:')
2461-
let &ul=&ul
2462+
let &ul = &ul
24622463
call append('$', ['a', 'b', 'c', 'd'])
2463-
let &ul=&ul
2464+
let &ul = &ul
24642465
call append('$', ['Z', 'Y', 'X', 'W'])
24652466
let a = execute(':changes')
24662467
call assert_match('2\s\+0\s\+2', a)
@@ -3266,6 +3267,20 @@ func Test_message_when_using_ctrl_c()
32663267
bwipe!
32673268
endfunc
32683269

3270+
func Test_mode_updated_after_ctrl_c()
3271+
CheckScreendump
3272+
3273+
let buf = RunVimInTerminal('', {'rows': 5})
3274+
call term_sendkeys(buf, "i")
3275+
call term_sendkeys(buf, "\<C-O>")
3276+
" wait a moment so that the "-- (insert) --" message is displayed
3277+
call TermWait(buf, 50)
3278+
call term_sendkeys(buf, "\<C-C>")
3279+
call VerifyScreenDump(buf, 'Test_mode_updated_1', {})
3280+
3281+
call StopVimInTerminal(buf)
3282+
endfunc
3283+
32693284
" Test for '[m', ']m', '[M' and ']M'
32703285
" Jumping to beginning and end of methods in Java-like languages
32713286
func Test_java_motion()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
5109,
737739
/**/
738740
5108,
739741
/**/

0 commit comments

Comments
 (0)