To: vim_dev@googlegroups.com Subject: Patch 8.2.0052 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0052 Problem: More-prompt not properly tested. Solution: Add a test case. (Dominique Pelle, closes #5404) Files: src/testdir/test_messages.vim *** ../vim-8.2.0051/src/testdir/test_messages.vim 2019-09-08 18:18:30.000000000 +0200 --- src/testdir/test_messages.vim 2019-12-28 17:09:02.325369257 +0100 *************** *** 1,6 **** --- 1,7 ---- " Tests for :messages, :echomsg, :echoerr source shared.vim + source term_util.vim function Test_messages() let oldmore = &more *************** *** 172,174 **** --- 173,270 ---- set ruler& showcmd& endfunc + + " Test more-prompt (see :help more-prompt). + func Test_message_more() + if !CanRunVimInTerminal() + throw 'Skipped: cannot run vim in terminal' + endif + let buf = RunVimInTerminal('', {'rows': 6}) + call term_sendkeys(buf, ":call setline(1, range(1, 100))\n") + + call term_sendkeys(buf, ":%p#\n") + call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))}) + + call term_sendkeys(buf, '?') + call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit ', term_getline(buf, 6))}) + + " Down a line with j, , or . + call term_sendkeys(buf, "j") + call WaitForAssert({-> assert_equal(' 6 6', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 7 7', term_getline(buf, 5))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 8 8', term_getline(buf, 5))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 9 9', term_getline(buf, 5))}) + + " Down a screen with , f, or . + call term_sendkeys(buf, 'f') + call WaitForAssert({-> assert_equal(' 14 14', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))}) + call term_sendkeys(buf, ' ') + call WaitForAssert({-> assert_equal(' 19 19', term_getline(buf, 5))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 24 24', term_getline(buf, 5))}) + + " Down a page (half a screen) with d. + call term_sendkeys(buf, 'd') + call WaitForAssert({-> assert_equal(' 27 27', term_getline(buf, 5))}) + + " Down all the way with 'G'. + call term_sendkeys(buf, 'G') + call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))}) + + " Up a line k, or . + call term_sendkeys(buf, 'k') + call WaitForAssert({-> assert_equal(' 99 99', term_getline(buf, 5))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 98 98', term_getline(buf, 5))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 97 97', term_getline(buf, 5))}) + + " Up a screen with b or . + call term_sendkeys(buf, 'b') + call WaitForAssert({-> assert_equal(' 92 92', term_getline(buf, 5))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 87 87', term_getline(buf, 5))}) + + " Up a page (half a screen) with u. + call term_sendkeys(buf, 'u') + call WaitForAssert({-> assert_equal(' 84 84', term_getline(buf, 5))}) + + " Up all the way with 'g'. + call term_sendkeys(buf, 'g') + call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))}) + + " All the way down. Pressing f should do nothing but pressing + " space should end the more prompt. + call term_sendkeys(buf, 'G') + call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))}) + call term_sendkeys(buf, 'f') + call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))}) + call term_sendkeys(buf, ' ') + call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))}) + + " Pressing g< shows the previous command output. + call term_sendkeys(buf, 'g<') + call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))}) + + call term_sendkeys(buf, ":%p#\n") + call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))}) + + " Stop command output with q, or CTRL-C. + call term_sendkeys(buf, 'q') + call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))}) + + call term_sendkeys(buf, ':q!') + call StopVimInTerminal(buf) + endfunc *** ../vim-8.2.0051/src/version.c 2019-12-28 14:06:46.151470752 +0100 --- src/version.c 2019-12-28 17:09:56.929172040 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 52, /**/ -- WOMAN: King of the who? ARTHUR: The Britons. WOMAN: Who are the Britons? ARTHUR: Well, we all are. we're all Britons and I am your king. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///