]> granicus.if.org Git - vim/commitdiff
patch 8.1.1711: listener callback called at the wrong moment v8.1.1711
authorBram Moolenaar <Bram@vim.org>
Wed, 17 Jul 2019 20:55:35 +0000 (22:55 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 17 Jul 2019 20:55:35 +0000 (22:55 +0200)
Problem:    Listener callback called at the wrong moment
Solution:   Invoke listeners before calling ml_delete_int(). (closes #4657)

src/memline.c
src/version.c

index af3e2f4434b090f52ebb1f71ddf102afa0964d78..0a947f9273f66f2509406f02c79c113185ea0bab 100644 (file)
@@ -3566,6 +3566,15 @@ adjust_text_props_for_delete(
 ml_delete(linenr_T lnum, int message)
 {
     ml_flush_line(curbuf);
+    if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count)
+       return FAIL;
+
+#ifdef FEAT_EVAL
+    // When inserting above recorded changes: flush the changes before changing
+    // the text.
+    may_invoke_listeners(curbuf, lnum, lnum + 1, -1);
+#endif
+
     return ml_delete_int(curbuf, lnum, message);
 }
 
@@ -3590,14 +3599,6 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message)
     int                textprop_save_len;
 #endif
 
-    if (lnum < 1 || lnum > buf->b_ml.ml_line_count)
-       return FAIL;
-
-#ifdef FEAT_EVAL
-    // When inserting above recorded changes: flush the changes before changing
-    // the text.
-    may_invoke_listeners(buf, lnum, lnum + 1, -1);
-#endif
     if (lowest_marked && lowest_marked > lnum)
        lowest_marked--;
 
index 74a16fe367267e278c6aa0703694739eb3631f30..6c6550b090de126b37d6b36b1942fdd8cf2d72f2 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1711,
 /**/
     1710,
 /**/