From da51ad51bf4fbd66619786d0e6a83fb3ca09930b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 15 Jun 2023 18:44:50 +0100 Subject: [PATCH] patch 9.0.1635: error message is cleared when removing mode message Problem: Error message is cleared when removing mode message. Solution: Also reset flags when the message is further down. --- src/message.c | 2 +- .../dumps/Test_message_not_cleared_after_mode_1.dump | 2 +- .../dumps/Test_message_not_cleared_after_mode_2.dump | 2 +- .../dumps/Test_message_not_cleared_after_mode_3.dump | 10 ++++++++++ src/testdir/test_messages.vim | 9 ++++++++- src/version.c | 2 ++ 6 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/testdir/dumps/Test_message_not_cleared_after_mode_3.dump diff --git a/src/message.c b/src/message.c index 44c4f85574..d047d4fcc8 100644 --- a/src/message.c +++ b/src/message.c @@ -1643,7 +1643,7 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr) // When drawing over the command line no need to clear it later or remove // the mode message. - if (msg_row == cmdline_row && msg_col == 0) + if (msg_row >= cmdline_row && msg_col == 0) { clear_cmdline = FALSE; mode_displayed = FALSE; diff --git a/src/testdir/dumps/Test_message_not_cleared_after_mode_1.dump b/src/testdir/dumps/Test_message_not_cleared_after_mode_1.dump index 9e8d20ac4d..7fc619e8ed 100644 --- a/src/testdir/dumps/Test_message_not_cleared_after_mode_1.dump +++ b/src/testdir/dumps/Test_message_not_cleared_after_mode_1.dump @@ -1,5 +1,5 @@ >o+0&#ffffff0|n|e| @71 -|t|w|o| @71 +|N|o|S|u|c|h|F|i|l|e| @64 |t|h|r|e@1| @69 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/dumps/Test_message_not_cleared_after_mode_2.dump b/src/testdir/dumps/Test_message_not_cleared_after_mode_2.dump index 49dabef4f6..4237533ef8 100644 --- a/src/testdir/dumps/Test_message_not_cleared_after_mode_2.dump +++ b/src/testdir/dumps/Test_message_not_cleared_after_mode_2.dump @@ -1,5 +1,5 @@ >o+0&#ffffff0|n|e| @71 -|t|w|o| @71 +|N|o|S|u|c|h|F|i|l|e| @64 |t|h|r|e@1| @69 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/dumps/Test_message_not_cleared_after_mode_3.dump b/src/testdir/dumps/Test_message_not_cleared_after_mode_3.dump new file mode 100644 index 0000000000..b6d82c7024 --- /dev/null +++ b/src/testdir/dumps/Test_message_not_cleared_after_mode_3.dump @@ -0,0 +1,10 @@ +|o+0&#ffffff0|n|e| @71 +|N|o|S|u|c|h|F|i|l>e| @64 +|t|h|r|e@1| @69 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@74 +|E+0#ffffff16#e000002|4@1|7|:| |C|a|n|'|t| |f|i|n|d| |f|i|l|e| |"|N|o|S|u|c|h|F|i|l|e|"| |i|n| |p|a|t|h| +0#0000000#ffffff0@14|2|,|1|0| @9|A|l@1| diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim index 0647afd287..6db17460b6 100644 --- a/src/testdir/test_messages.vim +++ b/src/testdir/test_messages.vim @@ -347,7 +347,8 @@ func Test_message_not_cleared_after_mode() endfunction set showmode set cmdheight=1 - call setline(1, ['one', 'two', 'three']) + call test_settime(1) + call setline(1, ['one', 'NoSuchFile', 'three']) END call writefile(lines, 'XmessageMode', 'D') let buf = RunVimInTerminal('-S XmessageMode', {'rows': 10}) @@ -361,6 +362,12 @@ func Test_message_not_cleared_after_mode() call TermWait(buf) call VerifyScreenDump(buf, 'Test_message_not_cleared_after_mode_2', {}) + " removing the mode message used to also clear the error message + call term_sendkeys(buf, ":set cmdheight=2\") + call term_sendkeys(buf, '2GvEgf') + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_message_not_cleared_after_mode_3', {}) + call StopVimInTerminal(buf) endfunc diff --git a/src/version.c b/src/version.c index 8f382e16f4..2665c51090 100644 --- a/src/version.c +++ b/src/version.c @@ -695,6 +695,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1635, /**/ 1634, /**/