1
0
forked from aniani/vim

patch 9.0.2075: TextChangedI may not always trigger

Problem:  TextChangedI may not always trigger
Solution: trigger it in more cases: for insert/
          append/change operations, and when
          opening a new line,

fixes: #13367
closes: #13375

Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
This commit is contained in:
Christian Brabandt
2023-10-27 19:26:49 +02:00
parent daef8c7437
commit 4bca4897a1
5 changed files with 41 additions and 12 deletions

View File

@@ -6292,6 +6292,8 @@ n_opencmd(cmdarg_T *cap)
(void)hasFolding(curwin->w_cursor.lnum,
NULL, &curwin->w_cursor.lnum);
#endif
// trigger TextChangedI for the 'o/O' command
curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf);
if (u_save((linenr_T)(curwin->w_cursor.lnum -
(cap->cmdchar == 'O' ? 1 : 0)),
(linenr_T)(curwin->w_cursor.lnum +
@@ -7083,6 +7085,10 @@ invoke_edit(
// Always reset "restart_edit", this is not a restarted edit.
restart_edit = 0;
// Reset Changedtick_i, so that TextChangedI will only be triggered for stuff
// from insert mode, for 'o/O' this has already been done in n_opencmd
if (cap->cmdchar != 'O' && cap->cmdchar != 'o')
curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf);
if (edit(cmd, startln, cap->count1))
cap->retval |= CA_COMMAND_BUSY;