Skip to content

Commit 1bed993

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.0.1826: keytrans() doesn't translate recorded key typed in a GUI
Problem: keytrans() doesn't translate recorded key typed in a GUI Solution: Handle CSI like K_SPECIAL, like in mb_unescape() closes: #12964 closes: #12966 Signed-off-by: Christian Brabandt <[email protected]> Co-authored-by: zeertzjq <[email protected]>
1 parent 6e55e85 commit 1bed993

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/message.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,15 +1842,23 @@ str2special(
18421842
}
18431843

18441844
c = *str;
1845-
if (c == K_SPECIAL && str[1] != NUL && str[2] != NUL)
1845+
if ((c == K_SPECIAL
1846+
#ifdef FEAT_GUI
1847+
|| c == CSI
1848+
#endif
1849+
) && str[1] != NUL && str[2] != NUL)
18461850
{
18471851
if (str[1] == KS_MODIFIER)
18481852
{
18491853
modifiers = str[2];
18501854
str += 3;
18511855
c = *str;
18521856
}
1853-
if (c == K_SPECIAL && str[1] != NUL && str[2] != NUL)
1857+
if ((c == K_SPECIAL
1858+
#ifdef FEAT_GUI
1859+
|| c == CSI
1860+
#endif
1861+
) && str[1] != NUL && str[2] != NUL)
18541862
{
18551863
c = TO_SPECIAL(str[1], str[2]);
18561864
str += 2;

src/testdir/test_gui.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,4 +1687,9 @@ func Test_gui_macro_csi()
16871687
iunmap <C-D>t
16881688
endfunc
16891689

1690+
func Test_gui_csi_keytrans()
1691+
call assert_equal('<C-L>', keytrans("\x9b\xfc\x04L"))
1692+
call assert_equal('<C-D>', keytrans("\x9b\xfc\x04D"))
1693+
endfunc
1694+
16901695
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

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

700700
static int included_patches[] =
701701
{ /* Add new patch number below this line */
702+
/**/
703+
1826,
702704
/**/
703705
1825,
704706
/**/

0 commit comments

Comments
 (0)