aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/message.c7
-rw-r--r--src/nvim/testdir/test_options.vim7
2 files changed, 9 insertions, 5 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 265585266a..c97e68207b 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -606,6 +606,7 @@ void msg_source(int attr)
}
recursive = true;
+ msg_scroll = true; // this will take more than one line
no_wait_return++;
char *p = get_emsg_source();
if (p != NULL) {
@@ -739,7 +740,6 @@ static bool emsg_multiline(const char *s, bool multiline)
}
emsg_on_display = true; // remember there is an error message
- msg_scroll++; // don't overwrite a previous message
attr = HL_ATTR(HLF_E); // set highlight mode for error messages
if (msg_scrolled != 0) {
need_wait_return = true; // needed in case emsg() is called after
@@ -750,9 +750,8 @@ static bool emsg_multiline(const char *s, bool multiline)
msg_ext_set_kind("emsg");
}
- /*
- * Display name and line number for the source of the error.
- */
+ // Display name and line number for the source of the error.
+ // Sets "msg_scroll".
msg_source(attr);
// Display the error message itself.
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index 6e9f2d2377..fdfc1c0f89 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -820,11 +820,16 @@ func Test_rightleftcmd()
set rightleft&
endfunc
-" Test for the "debug" option
+" Test for the 'debug' option
func Test_debug_option()
+ " redraw to avoid matching previous messages
+ redraw
set debug=beep
exe "normal \<C-c>"
call assert_equal('Beep!', Screenline(&lines))
+ call assert_equal('line 4:', Screenline(&lines - 1))
+ " only match the final colon in the line that shows the source
+ call assert_match(':$', Screenline(&lines - 2))
set debug&
endfunc