summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Pilling <robpilling@gmail.com>2022-01-20 14:44:38 +0000
committerBram Moolenaar <Bram@vim.org>2022-01-20 14:44:38 +0000
commit726f7f91fd17e3e7eb39614a20d10ea83c134df0 (patch)
tree894cae8896662b9de3ee9e74efd1f772b547c378
parent7e93577a957e4f402bb690c4c8629fd831e24a9d (diff)
patch 8.2.4156: fileinfo message overwrites echo'ed messagev8.2.4156
Problem: Fileinfo message overwrites echo'ed message. Solution: Reset need_fileinfo when displaying a message. (Rob Pilling, closes #9569)
-rw-r--r--src/message.c7
-rw-r--r--src/testdir/dumps/Test_fileinfo_after_echo.dump6
-rw-r--r--src/testdir/test_messages.vim31
-rw-r--r--src/version.c2
4 files changed, 46 insertions, 0 deletions
diff --git a/src/message.c b/src/message.c
index 04a51fbf35..31314d2c7d 100644
--- a/src/message.c
+++ b/src/message.c
@@ -181,6 +181,8 @@ msg_attr_keep(
< (int)(Rows - cmdline_row - 1) * Columns + sc_col)
set_keep_msg((char_u *)s, 0);
+ need_fileinfo = FALSE;
+
vim_free(buf);
--entered;
return retval;
@@ -1420,7 +1422,10 @@ msg_start(void)
int did_return = FALSE;
if (!msg_silent)
+ {
VIM_CLEAR(keep_msg);
+ need_fileinfo = FALSE;
+ }
#ifdef FEAT_EVAL
if (need_clr_eos)
@@ -2163,6 +2168,8 @@ msg_puts_attr_len(char *str, int maxlen, int attr)
msg_puts_printf((char_u *)str, maxlen);
else
msg_puts_display((char_u *)str, maxlen, attr, FALSE);
+
+ need_fileinfo = FALSE;
}
/*
diff --git a/src/testdir/dumps/Test_fileinfo_after_echo.dump b/src/testdir/dumps/Test_fileinfo_after_echo.dump
new file mode 100644
index 0000000000..787dced01d
--- /dev/null
+++ b/src/testdir/dumps/Test_fileinfo_after_echo.dump
@@ -0,0 +1,6 @@
+>h+0&#ffffff0|i| @72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|'+0#0000000&|b|'| |w|r|i|t@1|e|n| @45|1|,|1| @10|A|l@1|
diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim
index 62b5b2910e..1ba92ff5f2 100644
--- a/src/testdir/test_messages.vim
+++ b/src/testdir/test_messages.vim
@@ -344,4 +344,35 @@ func Test_echo_string_partial()
call assert_equal("function('CountSpaces', [{'ccccccccccc': ['ab', 'cd'], 'aaaaaaaaaaa': v:false, 'bbbbbbbbbbbb': ''}])", string(function('CountSpaces', [#{aaaaaaaaaaa: v:false, bbbbbbbbbbbb: '', ccccccccccc: ['ab', 'cd']}])))
endfunc
+" Message output was previously overwritten by the fileinfo display, shown
+" when switching buffers. If a buffer is switched to, then a message if
+" echoed, we should show the message, rather than overwriting it with
+" fileinfo.
+func Test_fileinfo_after_echo()
+ CheckScreendump
+
+ let content =<< trim END
+ file a.txt
+
+ hide edit b.txt
+ call setline(1, "hi")
+ setlocal modified
+
+ hide buffer a.txt
+
+ set updatetime=1
+ autocmd CursorHold * b b.txt | w | echo "'b' written"
+ END
+
+ call writefile(content, 'Xtest_fileinfo_after_echo')
+ let buf = RunVimInTerminal('-S Xtest_fileinfo_after_echo', #{rows: 6})
+ call VerifyScreenDump(buf, 'Test_fileinfo_after_echo', {})
+
+ call term_sendkeys(buf, ":q\<CR>")
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('Xtest_fileinfo_after_echo')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 6cccadfd2a..6eb853f45c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4156,
+/**/
4155,
/**/
4154,