Skip to content

Commit 800cdbb

Browse files
committed
patch 9.0.1634: message is cleared when removing mode message
Problem: Message is cleared when removing mode message (Gary Johnson). Solution: Do not clear the command line after displaying a message.
1 parent 19dfa27 commit 800cdbb

5 files changed

Lines changed: 58 additions & 0 deletions

File tree

src/message.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,14 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
16411641
attr &= ~MSG_HIST;
16421642
}
16431643

1644+
// When drawing over the command line no need to clear it later or remove
1645+
// the mode message.
1646+
if (msg_row == cmdline_row && msg_col == 0)
1647+
{
1648+
clear_cmdline = FALSE;
1649+
mode_displayed = FALSE;
1650+
}
1651+
16441652
// If the string starts with a composing character first draw a space on
16451653
// which the composing char can be drawn.
16461654
if (enc_utf8 && utf_iscomposing(utf_ptr2char(msgstr)))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
>o+0&#ffffff0|n|e| @71
2+
|t|w|o| @71
3+
|t|h|r|e@1| @69
4+
|~+0#4040ff13&| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|~| @73
10+
|f+0#0000000&|r|o|m| |D|e|b|u|g|S|i|l|e|n|t| |n|o|r|m|a|l| @33|1|,|1| @10|A|l@1|
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
>o+0&#ffffff0|n|e| @71
2+
|t|w|o| @71
3+
|t|h|r|e@1| @69
4+
|~+0#4040ff13&| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|~| @73
10+
|f+0#0000000&|r|o|m| |D|e|b|u|g|S|i|l|e|n|t| |v|i|s|u|a|l| @33|1|,|1| @10|A|l@1|

src/testdir/test_messages.vim

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,34 @@ func Test_message_more_scrollback()
336336
call StopVimInTerminal(buf)
337337
endfunc
338338

339+
func Test_message_not_cleared_after_mode()
340+
CheckRunVimInTerminal
341+
342+
let lines =<< trim END
343+
nmap <silent> gx :call DebugSilent('normal')<CR>
344+
vmap <silent> gx :call DebugSilent('visual')<CR>
345+
function DebugSilent(arg)
346+
echomsg "from DebugSilent" a:arg
347+
endfunction
348+
set showmode
349+
set cmdheight=1
350+
call setline(1, ['one', 'two', 'three'])
351+
END
352+
call writefile(lines, 'XmessageMode', 'D')
353+
let buf = RunVimInTerminal('-S XmessageMode', {'rows': 10})
354+
355+
call term_sendkeys(buf, 'gx')
356+
call TermWait(buf)
357+
call VerifyScreenDump(buf, 'Test_message_not_cleared_after_mode_1', {})
358+
359+
" removing the mode message used to also clear the intended message
360+
call term_sendkeys(buf, 'vEgx')
361+
call TermWait(buf)
362+
call VerifyScreenDump(buf, 'Test_message_not_cleared_after_mode_2', {})
363+
364+
call StopVimInTerminal(buf)
365+
endfunc
366+
339367
" Test verbose message before echo command
340368
func Test_echo_verbose_system()
341369
CheckRunVimInTerminal

src/version.c

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

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1634,
698700
/**/
699701
1633,
700702
/**/

0 commit comments

Comments
 (0)