Patch 9.0.0511

4 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 20, 2022, 7:45:55 AM9/20/22
to vim...@googlegroups.com

Patch 9.0.0511
Problem: Unnecessary scrolling for message of only one line.
Solution: Only set msg_scroll when needed. (closes #11178)
Files: src/message.c, src/testdir/test_messages.vim


*** ../vim-9.0.0510/src/message.c 2022-09-12 13:35:06.514946763 +0100
--- src/message.c 2022-09-20 12:41:15.136777464 +0100
***************
*** 535,545 ****
return;
recursive = TRUE;

- msg_scroll = TRUE; // this will take more than one line
++no_wait_return;
p = get_emsg_source();
if (p != NULL)
{
msg_attr((char *)p, attr);
vim_free(p);
}
--- 535,545 ----
return;
recursive = TRUE;

++no_wait_return;
p = get_emsg_source();
if (p != NULL)
{
+ msg_scroll = TRUE; // this will take more than one line
msg_attr((char *)p, attr);
vim_free(p);
}
***************
*** 767,774 ****
#endif
/*
* Display name and line number for the source of the error.
- * Sets "msg_scroll".
*/
msg_source(attr);

/*
--- 767,774 ----
#endif
/*
* Display name and line number for the source of the error.
*/
+ msg_scroll = TRUE;
msg_source(attr);

/*
*** ../vim-9.0.0510/src/testdir/test_messages.vim 2022-09-17 21:07:52.107993141 +0100
--- src/testdir/test_messages.vim 2022-09-20 12:41:15.140777457 +0100
***************
*** 166,171 ****
--- 166,203 ----
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
*** ../vim-9.0.0510/src/version.c 2022-09-20 12:02:24.701974364 +0100
--- src/version.c 2022-09-20 12:43:34.828522821 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 511,
/**/

--
hundred-and-one symptoms of being an internet addict:
103. When you find yourself in the "Computer" section of Barnes & Noble
enjoying yourself.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages