diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-07-17 22:55:35 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-07-17 22:55:35 +0200 |
commit | acf7544cf62227972eeb063d6d9ecddaa5682a73 (patch) | |
tree | c8000f3851a86bdf6ce85aaeaade8e41a2143cb4 /src/memline.c | |
parent | 4a0a161a9bdc074498b85e1dd6bb2aab62a53aee (diff) | |
download | vim-git-acf7544cf62227972eeb063d6d9ecddaa5682a73.tar.gz |
patch 8.1.1711: listener callback called at the wrong momentv8.1.1711
Problem: Listener callback called at the wrong moment
Solution: Invoke listeners before calling ml_delete_int(). (closes #4657)
Diffstat (limited to 'src/memline.c')
-rw-r--r-- | src/memline.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/memline.c b/src/memline.c index af3e2f443..0a947f927 100644 --- 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 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--; |