comparison src/edit.c @ 25967:46205b125fbd v8.2.3517

patch 8.2.3517: TextChanged does not trigger after TextChangedI Commit: https://github.com/vim/vim/commit/db3b44640d69ab27270691a3cab8d83cc93a0861 Author: Christian Brabandt <cb@256bit.org> Date: Sat Oct 16 11:58:55 2021 +0100 patch 8.2.3517: TextChanged does not trigger after TextChangedI Problem: TextChanged does not trigger after TextChangedI. Solution: Store the tick separately for TextChangedI. (Christian Brabandt, closes #8968, closes #8932)
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 Oct 2021 13:00:04 +0200
parents 45a8b2b2f652
children 2fc13817b100
comparison
equal deleted inserted replaced
25966:5c9d305e5f18 25967:46205b125fbd
1475 } 1475 }
1476 # endif 1476 # endif
1477 last_cursormoved = curwin->w_cursor; 1477 last_cursormoved = curwin->w_cursor;
1478 } 1478 }
1479 1479
1480 // Trigger TextChangedI if b_changedtick differs. 1480 // Trigger TextChangedI if b_changedtick_i differs.
1481 if (ready && has_textchangedI() 1481 if (ready && has_textchangedI()
1482 && curbuf->b_last_changedtick != CHANGEDTICK(curbuf) 1482 && curbuf->b_last_changedtick_i != CHANGEDTICK(curbuf)
1483 && !pum_visible()) 1483 && !pum_visible())
1484 { 1484 {
1485 aco_save_T aco; 1485 aco_save_T aco;
1486 varnumber_T tick = CHANGEDTICK(curbuf); 1486 varnumber_T tick = CHANGEDTICK(curbuf);
1487 1487
1488 // save and restore curwin and curbuf, in case the autocmd changes them 1488 // save and restore curwin and curbuf, in case the autocmd changes them
1489 aucmd_prepbuf(&aco, curbuf); 1489 aucmd_prepbuf(&aco, curbuf);
1490 apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf); 1490 apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
1491 aucmd_restbuf(&aco); 1491 aucmd_restbuf(&aco);
1492 curbuf->b_last_changedtick = CHANGEDTICK(curbuf); 1492 curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf);
1493 if (tick != CHANGEDTICK(curbuf)) // see ins_apply_autocmds() 1493 if (tick != CHANGEDTICK(curbuf)) // see ins_apply_autocmds()
1494 u_save(curwin->w_cursor.lnum, 1494 u_save(curwin->w_cursor.lnum,
1495 (linenr_T)(curwin->w_cursor.lnum + 1)); 1495 (linenr_T)(curwin->w_cursor.lnum + 1));
1496 } 1496 }
1497 1497
1498 // Trigger TextChangedP if b_changedtick differs. When the popupmenu closes 1498 // Trigger TextChangedP if b_changedtick_pum differs. When the popupmenu
1499 // TextChangedI will need to trigger for backwards compatibility, thus use 1499 // closes TextChangedI will need to trigger for backwards compatibility,
1500 // different b_last_changedtick* variables. 1500 // thus use different b_last_changedtick* variables.
1501 if (ready && has_textchangedP() 1501 if (ready && has_textchangedP()
1502 && curbuf->b_last_changedtick_pum != CHANGEDTICK(curbuf) 1502 && curbuf->b_last_changedtick_pum != CHANGEDTICK(curbuf)
1503 && pum_visible()) 1503 && pum_visible())
1504 { 1504 {
1505 aco_save_T aco; 1505 aco_save_T aco;