mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.0088: TextChanged not triggered for :norm! commands
Problem: TextChanged not triggered for :norm! commands (machakann, after v9.0.2031) Solution: Only reset curbuf->b_last_changedtick if TextChangedI was triggered in insert mode (and not blocked) Note: for unknown reasons, the test fails on Windows (but seems to work fine when running interactively) fixes: #13967 closes: #13984 Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
2975a54f28
commit
c9e79e5284
@ -843,7 +843,12 @@ doESCkey:
|
|||||||
if (cmdchar != 'r' && cmdchar != 'v' && c != Ctrl_C)
|
if (cmdchar != 'r' && cmdchar != 'v' && c != Ctrl_C)
|
||||||
ins_apply_autocmds(EVENT_INSERTLEAVE);
|
ins_apply_autocmds(EVENT_INSERTLEAVE);
|
||||||
did_cursorhold = FALSE;
|
did_cursorhold = FALSE;
|
||||||
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
|
|
||||||
|
// ins_redraw() triggers TextChangedI only when no characters
|
||||||
|
// are in the typeahead buffer, so only reset curbuf->b_last_changedtick
|
||||||
|
// if the TextChangedI was not blocked by char_avail() (e.g. using :norm!)
|
||||||
|
if (!char_avail())
|
||||||
|
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
|
||||||
return (c == Ctrl_O);
|
return (c == Ctrl_O);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -2706,6 +2706,24 @@ func Test_TextChangedI_with_setline()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_TextChanged_with_norm()
|
||||||
|
" For unknown reason this fails on MS-Windows
|
||||||
|
CheckNotMSWindows
|
||||||
|
CheckFeature terminal
|
||||||
|
let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': 3})
|
||||||
|
call assert_equal('running', term_getstatus(buf))
|
||||||
|
call term_sendkeys(buf, ":let g:a=0\<cr>")
|
||||||
|
call term_wait(buf, 50)
|
||||||
|
call term_sendkeys(buf, ":au! TextChanged * :let g:a+=1\<cr>")
|
||||||
|
call term_wait(buf, 50)
|
||||||
|
call term_sendkeys(buf, ":norm! ia\<cr>")
|
||||||
|
call term_wait(buf, 50)
|
||||||
|
call term_sendkeys(buf, ":echo g:a\<cr>")
|
||||||
|
call term_wait(buf, 50)
|
||||||
|
call WaitForAssert({-> assert_match('^1.*$', term_getline(buf, 3))})
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_Changed_FirstTime()
|
func Test_Changed_FirstTime()
|
||||||
CheckFeature terminal
|
CheckFeature terminal
|
||||||
CheckNotGui
|
CheckNotGui
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
88,
|
||||||
/**/
|
/**/
|
||||||
87,
|
87,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user