aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-27 08:29:21 +0800
committerGitHub <noreply@github.com>2022-09-27 08:29:21 +0800
commit1d337d4e2f2265b13ecf19a3bc17ad302d3b0d96 (patch)
tree3ed80c888b4e5f27bcde62921d8772505d3ff895 /src
parent7e98821e56a88487f24584463869432d8373a28e (diff)
downloadrneovim-1d337d4e2f2265b13ecf19a3bc17ad302d3b0d96.tar.gz
rneovim-1d337d4e2f2265b13ecf19a3bc17ad302d3b0d96.tar.bz2
rneovim-1d337d4e2f2265b13ecf19a3bc17ad302d3b0d96.zip
vim-patch:9.0.0595: extra newline in messages after a verbose shell message (#20359)
Problem: Extra newline in messages after a verbose shell message. Solution: Output the newline with msg_putchar_attr(). (closes vim/vim#11233) Make it possible to filter a screendump before comparing it. https://github.com/vim/vim/commit/1190139ed01c27539615beea9559a88b2551daf3 Cherry-pick Test_message_more_scrolledback() from patch 9.0.0592 because Nvim already behaves as intended.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/testdir/test_messages.vim60
2 files changed, 61 insertions, 1 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index e0b0dfb0bc..fd20d9dd81 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2315,7 +2315,7 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
if (t_col > 0) {
t_puts(&t_col, t_s, s, attr);
}
- if (p_more && !recurse) {
+ if (p_more && !recurse && !(s == sb_str + 1 && *sb_str == '\n')) {
store_sb_text((char **)&sb_str, (char *)s, attr, &sb_col, false);
}
diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim
index 8e66a2c529..42a1fdcfe2 100644
--- a/src/nvim/testdir/test_messages.vim
+++ b/src/nvim/testdir/test_messages.vim
@@ -316,6 +316,66 @@ func Test_message_more()
call StopVimInTerminal(buf)
endfunc
+" Test more-prompt scrollback
+func Test_message_more_scrollback()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set t_ut=
+ hi Normal ctermfg=15 ctermbg=0
+ for i in range(100)
+ echo i
+ endfor
+ END
+ call writefile(lines, 'XmoreScrollback', 'D')
+ let buf = RunVimInTerminal('-S XmoreScrollback', {'rows': 10})
+ call VerifyScreenDump(buf, 'Test_more_scrollback_1', {})
+
+ call term_sendkeys(buf, 'f')
+ call TermWait(buf)
+ call term_sendkeys(buf, 'b')
+ call VerifyScreenDump(buf, 'Test_more_scrollback_2', {})
+
+ call term_sendkeys(buf, 'q')
+ call TermWait(buf)
+ call StopVimInTerminal(buf)
+endfunc
+
+" Test verbose message before echo command
+func Test_echo_verbose_system()
+ CheckRunVimInTerminal
+ CheckUnix
+
+ let buf = RunVimInTerminal('', {'rows': 10})
+ call term_sendkeys(buf, ":4 verbose echo system('seq 20')\<CR>")
+ " Note that the screendump is filtered to remove the name of the temp file
+ call VerifyScreenDump(buf, 'Test_verbose_system_1', {})
+
+ " display a page and go back, results in exactly the same view
+ call term_sendkeys(buf, ' ')
+ call TermWait(buf)
+ call term_sendkeys(buf, 'b')
+ call VerifyScreenDump(buf, 'Test_verbose_system_1', {})
+
+ " do the same with 'cmdheight' set to 2
+ call term_sendkeys(buf, 'q')
+ call TermWait(buf)
+ call term_sendkeys(buf, ":set ch=2\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, ":4 verbose echo system('seq 20')\<CR>")
+ call VerifyScreenDump(buf, 'Test_verbose_system_2', {})
+
+ call term_sendkeys(buf, ' ')
+ call TermWait(buf)
+ call term_sendkeys(buf, 'b')
+ call VerifyScreenDump(buf, 'Test_verbose_system_2', {})
+
+ call term_sendkeys(buf, 'q')
+ call TermWait(buf)
+ call StopVimInTerminal(buf)
+endfunc
+
+
func Test_ask_yesno()
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})