mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
patch 9.2.0586: Crash with TextPut autocmd when pasting in terminal buffer
Problem: Crash with TextPut autocmd when pasting in normal mode in a
terminal buffer.
Solution: Skip the TextPut autocmds when reg and insert are both NULL
and regname is not '.' (Foxe Chen).
closes: #20407
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
77b2376769
commit
2e7833bde9
+5
-1
@@ -1190,6 +1190,11 @@ put_do_autocmd(
|
||||
if (recursive || regname == '_')
|
||||
return;
|
||||
|
||||
if (regname != '.' && insert == NULL
|
||||
&& reg == NULL)
|
||||
// Can happen when pasting text in normal mode in a terminal buffer
|
||||
return;
|
||||
|
||||
v_event = get_v_event(&save_v_event);
|
||||
|
||||
list = list_alloc();
|
||||
@@ -1219,7 +1224,6 @@ put_do_autocmd(
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(reg != NULL);
|
||||
for (n = 0; n < reg->y_size; n++)
|
||||
list_append_string(list, reg->y_array[n].string,
|
||||
(int)reg->y_array[n].length);
|
||||
|
||||
@@ -6094,7 +6094,35 @@ func Test_TextPutX()
|
||||
unlet g:post_event
|
||||
unlet g:pre_event
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test that attempting to put text in normal mode terminal buffer does not
|
||||
" result in a crash. This only happens when terminal is only window in tabpage
|
||||
" it seems.
|
||||
func Test_TextPutPost_term_norm()
|
||||
CheckFeature terminal
|
||||
|
||||
tabnew
|
||||
term ++curwin
|
||||
|
||||
let bnr = bufnr('$')
|
||||
call WaitForAssert({-> assert_equal('running', term_getstatus(bnr))})
|
||||
|
||||
call feedkeys("\<C-\>\<C-N>", 'xt')
|
||||
call WaitForAssert({-> assert_equal('running,normal', term_getstatus(bnr))})
|
||||
|
||||
let err = 0
|
||||
|
||||
try
|
||||
call feedkeys("p", 'xt')
|
||||
catch /^Vim\%((\S\+)\)\=:E21:/
|
||||
let err = 1
|
||||
endtry
|
||||
|
||||
call assert_true(err)
|
||||
|
||||
unlet err
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
586,
|
||||
/**/
|
||||
585,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user