aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-20 21:58:39 +0800
committerGitHub <noreply@github.com>2022-09-20 21:58:39 +0800
commitcfdc93e8ac3e6c1577f1582c4b9546c118aa7987 (patch)
tree146f7c40c982431dd790164bbbc7793893ae9b27 /src/nvim/testdir
parent86c5d761c4752c44acb0eb4ce7e7b41be3408969 (diff)
downloadrneovim-cfdc93e8ac3e6c1577f1582c4b9546c118aa7987.tar.gz
rneovim-cfdc93e8ac3e6c1577f1582c4b9546c118aa7987.tar.bz2
rneovim-cfdc93e8ac3e6c1577f1582c4b9546c118aa7987.zip
vim-patch:9.0.0511: unnecessary scrolling for message of only one line (#20261)
Problem: Unnecessary scrolling for message of only one line. Solution: Only set msg_scroll when needed. (closes vim/vim#11178) https://github.com/vim/vim/commit/bdedd2bcce3a59028c7504a397ff77d901b1b12a
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_messages.vim32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim
index a83fcd7138..0f348c22cb 100644
--- a/src/nvim/testdir/test_messages.vim
+++ b/src/nvim/testdir/test_messages.vim
@@ -171,6 +171,38 @@ func Test_echospace()
set ruler& showcmd&
endfunc
+func Test_warning_scroll()
+ CheckRunVimInTerminal
+ let lines =<< trim END
+ call test_override('ui_delay', 50)
+ set noruler
+ set readonly
+ undo
+ END
+ call writefile(lines, 'XTestWarningScroll', 'D')
+ let buf = RunVimInTerminal('', #{rows: 8})
+
+ " When the warning comes from a script, messages are scrolled so that the
+ " stacktrace is visible.
+ call term_sendkeys(buf, ":source XTestWarningScroll\n")
+ " only match the final colon in the line that shows the source
+ call WaitForAssert({-> assert_match(':$', term_getline(buf, 5))})
+ call WaitForAssert({-> assert_equal('line 4:W10: Warning: Changing a readonly file', term_getline(buf, 6))})
+ call WaitForAssert({-> assert_equal('Already at oldest change', term_getline(buf, 7))})
+ call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 8))})
+ call term_sendkeys(buf, "\n")
+
+ " When the warning does not come from a script, messages are not scrolled.
+ call term_sendkeys(buf, ":enew\n")
+ call term_sendkeys(buf, ":set readonly\n")
+ call term_sendkeys(buf, 'u')
+ call WaitForAssert({-> assert_equal('W10: Warning: Changing a readonly file', term_getline(buf, 8))})
+ call WaitForAssert({-> assert_equal('Already at oldest change', term_getline(buf, 8))})
+
+ " clean up
+ call StopVimInTerminal(buf)
+endfunc
+
" Test more-prompt (see :help more-prompt).
func Test_message_more()
CheckRunVimInTerminal