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.
1190139ed0

Cherry-pick Test_message_more_scrolledback() from patch 9.0.0592 because
Nvim already behaves as intended.
This commit is contained in:
zeertzjq
2022-09-27 08:29:21 +08:00
committed by GitHub
parent 7e98821e56
commit 1d337d4e2f
3 changed files with 199 additions and 19 deletions

View File

@@ -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);
}

View File

@@ -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})