0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.0756: no autocmd event for changing text in a terminal window

Problem:    No autocmd event for changing text in a terminal window.
Solution:   Add TextChangedT. (Shougo Matsushita, closes #11366)
This commit is contained in:
Shougo Matsushita
2022-10-15 11:48:00 +01:00
committed by Bram Moolenaar
parent d988ef3a55
commit 4ccaedfcd7
6 changed files with 70 additions and 0 deletions

View File

@@ -1222,6 +1222,8 @@ update_cursor(term_T *term, int redraw)
setcursor();
if (redraw)
{
aco_save_T aco;
if (term->tl_buffer == curbuf && term->tl_cursor_visible)
cursor_on();
out_flush();
@@ -1232,6 +1234,16 @@ update_cursor(term_T *term, int redraw)
gui_mch_flush();
}
#endif
// Make sure an invoked autocmd doesn't delete the buffer (and the
// terminal) under our fingers.
++term->tl_buffer->b_locked;
// save and restore curwin and curbuf, in case the autocmd changes them
aucmd_prepbuf(&aco, curbuf);
apply_autocmds(EVENT_TEXTCHANGEDT, NULL, NULL, FALSE, term->tl_buffer);
aucmd_restbuf(&aco);
--term->tl_buffer->b_locked;
}
}