diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 4b12901916..3960bad649 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -810,26 +810,27 @@ This message is given when the screen is filled with messages. It is only given when the 'more' option is on. It is highlighted with the |hl-MoreMsg| group. -Type effect ~ - or or j or one more line - d down a page (half a screen) - or f or down a screen - G down all the way, until the hit-enter - prompt +Type effect ~ + or or j or one more line + d down a page (half a screen) + or f or or CTRL-F down a screen + G down all the way, until the + hit-enter prompt - or k or one line back - u up a page (half a screen) - b or back a screen - g back to the start + or k or one line back + u up a page (half a screen) + b or or CTRL-B back a screen + g back to the start - q, or CTRL-C stop the listing - : stop the listing and enter a - command-line - yank (copy) a modeless selection to - the clipboard ("* and "+ registers) - {menu-entry} what the menu is defined to in - Cmdline-mode. - next page* + q, or CTRL-C stop the listing + : stop the listing and enter a + command-line + yank (copy) a modeless + selection to the clipboard + ("* and "+ registers) + {menu-entry} what the menu is defined to + in Cmdline-mode. + next page* Any other key causes the meaning of the keys to be displayed. diff --git a/src/nvim/message.c b/src/nvim/message.c index 1125dddd42..cf7922c978 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1447,7 +1447,7 @@ void wait_return(int redraw) // to avoid that typing one 'j' too many makes the messages // disappear. if (p_more) { - if (c == 'b' || c == 'k' || c == 'u' || c == 'g' + if (c == 'b' || c == Ctrl_B || c == 'k' || c == 'u' || c == 'g' || c == K_UP || c == K_PAGEUP) { if (msg_scrolled > Rows) { // scroll back to show older messages @@ -1466,7 +1466,7 @@ void wait_return(int redraw) hit_return_msg(false); } } else if (msg_scrolled > Rows - 2 - && (c == 'j' || c == 'd' || c == 'f' + && (c == 'j' || c == 'd' || c == 'f' || c == Ctrl_F || c == K_DOWN || c == K_PAGEDOWN)) { c = K_IGNORE; } @@ -2993,12 +2993,14 @@ static bool do_more_prompt(int typed_char) break; case 'b': // one page back + case Ctrl_B: case K_PAGEUP: toscroll = -(Rows - 1); break; case ' ': // one extra page case 'f': + case Ctrl_F: case K_PAGEDOWN: case K_LEFTMOUSE: toscroll = Rows - 1; diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 8eb2436cbe..ee8034d68f 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -192,7 +192,7 @@ describe('messages', function() {6:-- More --}^ | ]]) - -- Down a screen with , f, or . + -- Down a screen with , f, , or . feed('f') screen:expect([[ {8: 10 }10 | @@ -202,7 +202,7 @@ describe('messages', function() {8: 14 }14 | {6:-- More --}^ | ]]) - feed('') + feed('\6') screen:expect([[ {8: 15 }15 | {8: 16 }16 | @@ -211,7 +211,7 @@ describe('messages', function() {8: 19 }19 | {6:-- More --}^ | ]]) - feed('') + feed(' ') screen:expect([[ {8: 20 }20 | {8: 21 }21 | @@ -220,15 +220,24 @@ describe('messages', function() {8: 24 }24 | {6:-- More --}^ | ]]) + feed('') + screen:expect([[ + {8: 25 }25 | + {8: 26 }26 | + {8: 27 }27 | + {8: 28 }28 | + {8: 29 }29 | + {6:-- More --}^ | + ]]) -- Down a page (half a screen) with d. feed('d') screen:expect([[ - {8: 23 }23 | - {8: 24 }24 | - {8: 25 }25 | - {8: 26 }26 | - {8: 27 }27 | + {8: 28 }28 | + {8: 29 }29 | + {8: 30 }30 | + {8: 31 }31 | + {8: 32 }32 | {6:-- More --}^ | ]]) @@ -272,7 +281,7 @@ describe('messages', function() {6:-- More --}^ | ]]) - -- Up a screen with b or . + -- Up a screen with b, or . feed('b') screen:expect([[ {8: 88 }88 | @@ -282,7 +291,7 @@ describe('messages', function() {8: 92 }92 | {6:-- More --}^ | ]]) - feed('') + feed('\2') screen:expect([[ {8: 83 }83 | {8: 84 }84 | @@ -291,15 +300,24 @@ describe('messages', function() {8: 87 }87 | {6:-- More --}^ | ]]) + feed('') + screen:expect([[ + {8: 78 }78 | + {8: 79 }79 | + {8: 80 }80 | + {8: 81 }81 | + {8: 82 }82 | + {6:-- More --}^ | + ]]) -- Up a page (half a screen) with u. feed('u') screen:expect([[ - {8: 80 }80 | - {8: 81 }81 | - {8: 82 }82 | - {8: 83 }83 | - {8: 84 }84 | + {8: 75 }75 | + {8: 76 }76 | + {8: 77 }77 | + {8: 78 }78 | + {8: 79 }79 | {6:-- More --}^ | ]]) @@ -314,7 +332,7 @@ describe('messages', function() {6:-- More --}^ | ]]) - -- All the way down. Pressing f should do nothing but pressing + -- All the way down. Pressing f or CTRL-F should do nothing but pressing -- space should end the more prompt. feed('G') screen:expect([[ @@ -327,6 +345,8 @@ describe('messages', function() ]]) feed('f') screen:expect_unchanged() + feed('') + screen:expect_unchanged() feed('') screen:expect([[ 96 | diff --git a/test/old/testdir/test_messages.vim b/test/old/testdir/test_messages.vim index a1531f3d73..b57cd6e294 100644 --- a/test/old/testdir/test_messages.vim +++ b/test/old/testdir/test_messages.vim @@ -241,18 +241,20 @@ func Test_message_more() call term_sendkeys(buf, "\") call WaitForAssert({-> assert_equal(' 9 9', term_getline(buf, 5))}) - " Down a screen with , f, or . + " 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 term_sendkeys(buf, "\") call WaitForAssert({-> assert_equal(' 19 19', term_getline(buf, 5))}) - call term_sendkeys(buf, "\") + call term_sendkeys(buf, ' ') call WaitForAssert({-> assert_equal(' 24 24', term_getline(buf, 5))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 29 29', 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))}) + call WaitForAssert({-> assert_equal(' 32 32', term_getline(buf, 5))}) " Down all the way with 'G'. call term_sendkeys(buf, 'G') @@ -267,15 +269,17 @@ func Test_message_more() call term_sendkeys(buf, "\") call WaitForAssert({-> assert_equal(' 97 97', term_getline(buf, 5))}) - " Up a screen with b or . + " 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 term_sendkeys(buf, "\") call WaitForAssert({-> assert_equal(' 87 87', term_getline(buf, 5))}) + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_equal(' 82 82', 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))}) + call WaitForAssert({-> assert_equal(' 79 79', term_getline(buf, 5))}) " Up all the way with 'g'. call term_sendkeys(buf, 'g') @@ -283,13 +287,16 @@ func Test_message_more() call WaitForAssert({-> assert_equal(':%p#', term_getline(buf, 1))}) call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))}) - " All the way down. Pressing f should do nothing but pressing + " All the way down. Pressing f or Ctrl-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 100', term_getline(buf, 5))}) + call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))}) call term_sendkeys(buf, ' ') call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))}) @@ -347,6 +354,11 @@ func Test_message_more_scrollback() call term_sendkeys(buf, 'b') call VerifyScreenDump(buf, 'Test_more_scrollback_2', {}) + call term_sendkeys(buf, "\") + call TermWait(buf) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_more_scrollback_2', {}) + call term_sendkeys(buf, 'q') call TermWait(buf) call StopVimInTerminal(buf)