neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 93d1473732e00ebde24268db3e0a723a2ea62cd1
parent 92b834fc7a66194b01104197a338d2673375a6aa
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Tue, 14 Oct 2025 08:42:36 +0800

vim-patch:9.1.1853: Ctrl-F and Ctrl-B at more prompt not working with key protocol

Problem:  Ctrl-F and Ctrl-B at more prompt not working with kitty
          keyboard protocol or modifyOtherKeys (after v9.1.1849).
Solution: Call merge_modifyOtherKeys() in get_keystroke() (zeertzjq).

closes: vim/vim#18558

https://github.com/vim/vim/commit/6622dc2ded496f9e1484034cd4f53e9ba900026f

Diffstat:
Msrc/nvim/input.c | 3++-
Mtest/functional/legacy/messages_spec.lua | 20++++++++++++++++++++
Mtest/old/testdir/test_messages.vim | 15+++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/nvim/input.c b/src/nvim/input.c @@ -78,6 +78,7 @@ int get_keystroke(MultiQueue *events) int n; int save_mapped_ctrl_c = mapped_ctrl_c; + mod_mask = 0; mapped_ctrl_c = 0; // mappings are not used here while (true) { // flush output before waiting @@ -141,7 +142,7 @@ int get_keystroke(MultiQueue *events) xfree(buf); mapped_ctrl_c = save_mapped_ctrl_c; - return n; + return merge_modifiers(n, &mod_mask); } /// Ask the user for input through a cmdline prompt. diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua @@ -321,6 +321,26 @@ describe('messages', function() {6:-- More --}^ | ]]) + -- Test <C-F> and <C-B> as keycodes instead of raw control chars. + feed('<C-F>') + screen:expect([[ + {8: 80 }80 | + {8: 81 }81 | + {8: 82 }82 | + {8: 83 }83 | + {8: 84 }84 | + {6:-- More --}^ | + ]]) + feed('<C-B>') + screen:expect([[ + {8: 75 }75 | + {8: 76 }76 | + {8: 77 }77 | + {8: 78 }78 | + {8: 79 }79 | + {6:-- More --}^ | + ]]) + -- Up all the way with 'g'. feed('g') screen:expect([[ diff --git a/test/old/testdir/test_messages.vim b/test/old/testdir/test_messages.vim @@ -218,6 +218,7 @@ func Test_message_more() CheckRunVimInTerminal let buf = RunVimInTerminal('', {'rows': 6}) + let chan = buf->term_getjob()->job_getchannel() call term_sendkeys(buf, ":call setline(1, range(1, 100))\n") call term_sendkeys(buf, ":%pfoo\<C-H>\<C-H>\<C-H>#") @@ -281,6 +282,19 @@ func Test_message_more() call term_sendkeys(buf, 'u') call WaitForAssert({-> assert_equal(' 79 79', term_getline(buf, 5))}) + " Test <C-F> and <C-B> with different keyboard protocols. + for [ctrl_f, ctrl_b] in [ + \ [GetEscCodeCSI27('f', 5), GetEscCodeCSI27('b', 5)], + \ [GetEscCodeCSI27('F', 5), GetEscCodeCSI27('B', 5)], + \ [GetEscCodeCSIu('f', 5), GetEscCodeCSIu('b', 5)], + \ [GetEscCodeCSIu('F', 5), GetEscCodeCSIu('B', 5)], + \ ] + call ch_sendraw(chan, ctrl_f) + call WaitForAssert({-> assert_equal(' 84 84', term_getline(buf, 5))}) + call ch_sendraw(chan, ctrl_b) + call WaitForAssert({-> assert_equal(' 79 79', term_getline(buf, 5))}) + endfor + " Up all the way with 'g'. call term_sendkeys(buf, 'g') call WaitForAssert({-> assert_equal(' 4 4', term_getline(buf, 5))}) @@ -294,6 +308,7 @@ func Test_message_more() 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 WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))}) 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))})