Skip to content

Commit 2abad54

Browse files
committed
patch 8.1.0002: :stopinsert changes the message position
Problem: :stopinsert changes the message position. Solution: Save and restore msg_col and msg_row in clearmode(). (Jason Franklin)
1 parent 2f01889 commit 2abad54

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

src/screen.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10485,10 +10485,16 @@ unshowmode(int force)
1048510485
void
1048610486
clearmode(void)
1048710487
{
10488+
int save_msg_row = msg_row;
10489+
int save_msg_col = msg_col;
10490+
1048810491
msg_pos_mode();
1048910492
if (Recording)
1049010493
recording_mode(HL_ATTR(HLF_CM));
1049110494
msg_clr_eos();
10495+
10496+
msg_col = save_msg_col;
10497+
msg_row = save_msg_row;
1049210498
}
1049310499

1049410500
static void

src/testdir/test_messages.vim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,24 @@ function Test_messages()
3838
let &more = oldmore
3939
endtry
4040
endfunction
41+
42+
" Patch 7.4.1696 defined the "clearmode()" command for clearing the mode
43+
" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message
44+
" output could then be disturbed when 'cmdheight' was greater than one.
45+
" This test ensures that the bugfix for this issue remains in place.
46+
function! Test_stopinsert_does_not_break_message_output()
47+
set cmdheight=2
48+
redraw!
49+
50+
stopinsert | echo 'test echo'
51+
call assert_equal(116, screenchar(&lines - 1, 1))
52+
call assert_equal(32, screenchar(&lines, 1))
53+
redraw!
54+
55+
stopinsert | echomsg 'test echomsg'
56+
call assert_equal(116, screenchar(&lines - 1, 1))
57+
call assert_equal(32, screenchar(&lines, 1))
58+
redraw!
59+
60+
set cmdheight&
61+
endfunction

src/version.c

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

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
2,
764766
/**/
765767
1,
766768
/**/

0 commit comments

Comments
 (0)