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

6622dc2ded
This commit is contained in:
zeertzjq
2025-10-14 08:42:36 +08:00
parent 92b834fc7a
commit 93d1473732
3 changed files with 37 additions and 1 deletions

View File

@@ -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.

View File

@@ -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([[

View File

@@ -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))})