To: vim_dev@googlegroups.com Subject: Patch 8.1.1711 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1711 Problem: Listener callback called at the wrong moment Solution: Invoke listeners before calling ml_delete_int(). (closes #4657) Files: src/memline.c *** ../vim-8.1.1710/src/memline.c 2019-07-15 23:02:10.039954907 +0200 --- src/memline.c 2019-07-17 22:53:59.739478625 +0200 *************** *** 3566,3571 **** --- 3566,3580 ---- 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,3603 **** 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--; --- 3599,3604 ---- *** ../vim-8.1.1710/src/version.c 2019-07-17 22:00:15.591219445 +0200 --- src/version.c 2019-07-17 22:55:17.355101243 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1711, /**/ -- Kisses may last for as much as, but no more than, five minutes. [real standing law in Iowa, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///