Skip to content

Commit 6622dc2

Browse files
zeertzjqchrisbra
authored andcommitted
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: #18558 Signed-off-by: zeertzjq <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent a55dc8c commit 6622dc2

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/misc1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ get_keystroke(void)
871871
int save_mapped_ctrl_c = mapped_ctrl_c;
872872
int waited = 0;
873873

874+
mod_mask = 0;
874875
mapped_ctrl_c = FALSE; // mappings are not used here
875876
for (;;)
876877
{
@@ -974,7 +975,7 @@ get_keystroke(void)
974975
vim_free(buf);
975976

976977
mapped_ctrl_c = save_mapped_ctrl_c;
977-
return n;
978+
return merge_modifyOtherKeys(n, &mod_mask);
978979
}
979980

980981
// For overflow detection, add a digit safely to an int value.

src/testdir/test_messages.vim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ func Test_message_more()
209209
CheckRunVimInTerminal
210210

211211
let buf = RunVimInTerminal('', {'rows': 6})
212+
let chan = buf->term_getjob()->job_getchannel()
212213
call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
213214

214215
call term_sendkeys(buf, ":%pfoo\<C-H>\<C-H>\<C-H>#")
@@ -272,6 +273,19 @@ func Test_message_more()
272273
call term_sendkeys(buf, 'u')
273274
call WaitForAssert({-> assert_equal(' 79 79', term_getline(buf, 5))})
274275

276+
" Test <C-F> and <C-B> with different keyboard protocols.
277+
for [ctrl_f, ctrl_b] in [
278+
\ [GetEscCodeCSI27('f', 5), GetEscCodeCSI27('b', 5)],
279+
\ [GetEscCodeCSI27('F', 5), GetEscCodeCSI27('B', 5)],
280+
\ [GetEscCodeCSIu('f', 5), GetEscCodeCSIu('b', 5)],
281+
\ [GetEscCodeCSIu('F', 5), GetEscCodeCSIu('B', 5)],
282+
\ ]
283+
call ch_sendraw(chan, ctrl_f)
284+
call WaitForAssert({-> assert_equal(' 84 84', term_getline(buf, 5))})
285+
call ch_sendraw(chan, ctrl_b)
286+
call WaitForAssert({-> assert_equal(' 79 79', term_getline(buf, 5))})
287+
endfor
288+
275289
" Up all the way with 'g'.
276290
call term_sendkeys(buf, 'g')
277291
call WaitForAssert({-> assert_equal(' 4 4', term_getline(buf, 5))})
@@ -285,6 +299,7 @@ func Test_message_more()
285299
call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
286300
call term_sendkeys(buf, 'f')
287301
call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
302+
call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
288303
call term_sendkeys(buf, "\<C-F>")
289304
call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
290305
call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ static char *(features[]) =
729729

730730
static int included_patches[] =
731731
{ /* Add new patch number below this line */
732+
/**/
733+
1853,
732734
/**/
733735
1852,
734736
/**/

0 commit comments

Comments
 (0)