Skip to content

Commit

Permalink
patch 9.0.0940: crash when typing a letter in a terminal window
Browse files Browse the repository at this point in the history
Problem:    Crash when typing a letter in a terminal window. (Shane-XB-Qian)
Solution:   Use the "vterm" variable instead of getting the terminal pointer
            from the current buffer.  (closes #11608)
  • Loading branch information
brammool committed Nov 24, 2022
1 parent 47f1fdc commit ebed1b0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/terminal.c
Expand Up @@ -1590,7 +1590,7 @@ term_convert_key(term_T *term, int c, int modmask, char *buf)
// Ctrl-Shift-i may have the key "I" instead of "i", but for the kitty
// keyboard protocol should use "i". Applies to all ascii letters.
if (ASCII_ISUPPER(c)
&& vterm_is_kitty_keyboard(curbuf->b_term->tl_vterm)
&& vterm_is_kitty_keyboard(vterm)
&& mod == (VTERM_MOD_CTRL | VTERM_MOD_SHIFT))
c = TOLOWER_ASC(c);

Expand Down
5 changes: 5 additions & 0 deletions src/testdir/test_termcodes.vim
Expand Up @@ -2156,6 +2156,9 @@ func Test_modifyOtherKeys_no_mapping()
endfunc

func Test_CSIu_keys_without_modifiers()
" make this execute faster
set timeoutlen=10

" Escape sent as `CSI 27 u` should act as normal escape and not undo
call setline(1, 'a')
call feedkeys('a' .. GetEscCodeCSIuWithoutModifier("\e"), 'Lx!')
Expand All @@ -2166,6 +2169,8 @@ func Test_CSIu_keys_without_modifiers()
call setline(1, '')
call feedkeys('a' .. GetEscCodeCSIuWithoutModifier("\t") .. "\<Esc>", 'Lx!')
call assert_equal("\t", getline(1))

set timeoutlen&
endfunc

" Check that when DEC mouse codes are recognized a special key is handled.
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
940,
/**/
939,
/**/
Expand Down

0 comments on commit ebed1b0

Please sign in to comment.