Skip to content

Commit acf7544

Browse files
committed
patch 8.1.1711: listener callback called at the wrong moment
Problem: Listener callback called at the wrong moment Solution: Invoke listeners before calling ml_delete_int(). (closes #4657)
1 parent 4a0a161 commit acf7544

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/memline.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,6 +3566,15 @@ adjust_text_props_for_delete(
35663566
ml_delete(linenr_T lnum, int message)
35673567
{
35683568
ml_flush_line(curbuf);
3569+
if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count)
3570+
return FAIL;
3571+
3572+
#ifdef FEAT_EVAL
3573+
// When inserting above recorded changes: flush the changes before changing
3574+
// the text.
3575+
may_invoke_listeners(curbuf, lnum, lnum + 1, -1);
3576+
#endif
3577+
35693578
return ml_delete_int(curbuf, lnum, message);
35703579
}
35713580

@@ -3590,14 +3599,6 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
35903599
int textprop_save_len;
35913600
#endif
35923601

3593-
if (lnum < 1 || lnum > buf->b_ml.ml_line_count)
3594-
return FAIL;
3595-
3596-
#ifdef FEAT_EVAL
3597-
// When inserting above recorded changes: flush the changes before changing
3598-
// the text.
3599-
may_invoke_listeners(buf, lnum, lnum + 1, -1);
3600-
#endif
36013602
if (lowest_marked && lowest_marked > lnum)
36023603
lowest_marked--;
36033604

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1711,
780782
/**/
781783
1710,
782784
/**/

0 commit comments

Comments
 (0)