Mercurial > vim
changeset 17425:6580e2dfcaeb v8.1.1711
patch 8.1.1711: listener callback called at the wrong moment
commit https://github.com/vim/vim/commit/acf7544cf62227972eeb063d6d9ecddaa5682a73
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 17 22:55:35 2019 +0200
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 https://github.com/vim/vim/issues/4657)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Jul 2019 23:00:06 +0200 |
parents | bc21f0261afb |
children | 4240f8ba788f |
files | src/memline.c src/version.c |
diffstat | 2 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/memline.c +++ b/src/memline.c @@ -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 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--;