]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1849: CTRL-F and CTRL-B don't work in more prompt v9.1.1849
authorbfoersterling <bjoern.foersterling@gmail.com>
Sun, 12 Oct 2025 14:26:34 +0000 (14:26 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 12 Oct 2025 14:26:34 +0000 (14:26 +0000)
Problem:  CTRL-F and CTRL-B don't work in more prompt
Solution: Make CTRL-F and CTRL-B scroll by a screen down/up
          (Bjoern Foersterling)

closes: #18545

Signed-off-by: bfoersterling <bjoern.foersterling@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/message.txt
runtime/doc/version9.txt
src/message.c
src/testdir/test_messages.vim
src/version.c

index 048f428cbed6cc27e8de36ccbf078857a5600407..1c9de0cbc27cf30338a5cc0a3f4509b5c5df20da 100644 (file)
@@ -1,4 +1,4 @@
-*message.txt*   For Vim version 9.1.  Last change: 2025 Aug 06
+*message.txt*   For Vim version 9.1.  Last change: 2025 Oct 12
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -859,26 +859,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 ~
-     <CR> or <NL> or j or <Down>       one more line
-     d                                 down a page (half a screen)
-     <Space> or f or <PageDown>                down a screen
-     G                                 down all the way, until the hit-enter
-                                       prompt
-
-     <BS> or k or <Up>                 one line back
-     u                                 up a page (half a screen)
-     b or <PageUp>                     back a screen
-     g                                 back to the start
-
-     q, <Esc> or CTRL-C                        stop the listing
-     :                                 stop the listing and enter a
-                                            command-line
-    <C-Y>                              yank (copy) a modeless selection to
-                                       the clipboard ("* and "+ registers)
-    {menu-entry}                       what the menu is defined to in
-                                       Cmdline-mode.
-    <LeftMouse>                                next page (*)
+Type                                           effect ~
+     <CR> or <NL> or j or <Down>               one more line
+     d                                         down a page (half a screen)
+     <Space> or f or <PageDown> or CTRL-F      down a screen
+     G                                         down all the way, until the
+                                               hit-enter prompt
+
+     <BS> or k or <Up>                         one line back
+     u                                         up a page (half a screen)
+     b or <PageUp> or CTRL-B                   back a screen
+     g                                         back to the start
+
+     q, <Esc> or CTRL-C                                stop the listing
+     :                                         stop the listing and enter a
+                                               command-line
+    <C-Y>                                      yank (copy) a modeless
+                                               selection to the clipboard
+                                               ("* and "+ registers)
+    {menu-entry}                               what the menu is defined to
+                                               in Cmdline-mode.
+    <LeftMouse>                                        next page (*)
 
 Any other key causes the meaning of the keys to be displayed.
 
index 0a662f7ccd26bce89faaa21e2415ee27b5118fb3..90cd5c4c7223329f31d1dae409bb9411074f1196 100644 (file)
@@ -1,4 +1,4 @@
-*version9.txt*  For Vim version 9.1.  Last change: 2025 Oct 07
+*version9.txt*  For Vim version 9.1.  Last change: 2025 Oct 12
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41780,6 +41780,7 @@ Others: ~
   Command-line.
 - |min()|/|max()| can handle all comparable data types.
 - Vim triggers the |TermResponseAll| autocommand for any terminal OSC value.
+- Support CTRL-B and CTRL-F in the |more-prompt|.
 
                                                        *added-9.2*
 Added ~
index 5ec5c59a993d163339509a24258447079b6fb8d0..d4ebc8e68f5e864efec4f1eb0fea11398eda2b0d 100644 (file)
@@ -1356,7 +1356,7 @@ wait_return(int redraw)
                */
                if (p_more && !p_cp)
                {
-                   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)
@@ -1385,7 +1385,7 @@ wait_return(int redraw)
                        }
                    }
                    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;
                }
@@ -3318,12 +3318,14 @@ 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;
index 61193dfd3d26185509193b6b2e0efd6db1bd3677..b1dfa7075aaf67f16a3ef9fc134155f9ed442b1c 100644 (file)
@@ -232,18 +232,20 @@ func Test_message_more()
   call term_sendkeys(buf, "\<Down>")
   call WaitForAssert({-> assert_equal('  9 9', term_getline(buf, 5))})
 
-  " Down a screen with <Space>, f, or <PageDown>.
+  " Down a screen with <Space>, f, <C-F> or <PageDown>.
   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, "\<C-F>")
   call WaitForAssert({-> assert_equal(' 19 19', term_getline(buf, 5))})
-  call term_sendkeys(buf, "\<PageDown>")
+  call term_sendkeys(buf, ' ')
   call WaitForAssert({-> assert_equal(' 24 24', term_getline(buf, 5))})
+  call term_sendkeys(buf, "\<PageDown>")
+  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')
@@ -258,15 +260,17 @@ func Test_message_more()
   call term_sendkeys(buf, "\<Up>")
   call WaitForAssert({-> assert_equal(' 97 97', term_getline(buf, 5))})
 
-  " Up a screen with b or <PageUp>.
+  " Up a screen with b, <C-B> or <PageUp>.
   call term_sendkeys(buf, 'b')
   call WaitForAssert({-> assert_equal(' 92 92', term_getline(buf, 5))})
-  call term_sendkeys(buf, "\<PageUp>")
+  call term_sendkeys(buf, "\<C-B>")
   call WaitForAssert({-> assert_equal(' 87 87', term_getline(buf, 5))})
+  call term_sendkeys(buf, "\<PageUp>")
+  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')
@@ -274,13 +278,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, "\<C-F>")
+  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))})
 
@@ -339,6 +346,11 @@ func Test_message_more_scrollback()
   call term_sendkeys(buf, 'b')
   call VerifyScreenDump(buf, 'Test_more_scrollback_2', {})
 
+  call term_sendkeys(buf, "\<C-F>")
+  call TermWait(buf)
+  call term_sendkeys(buf, "\<C-B>")
+  call VerifyScreenDump(buf, 'Test_more_scrollback_2', {})
+
   call term_sendkeys(buf, 'q')
   call TermWait(buf)
   call StopVimInTerminal(buf)
index a2f10f91142501ebb989f55f0a976b01edbc6a2b..c28ce040a6b7b770ece8741e86c318bef64f179e 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1849,
 /**/
     1848,
 /**/