diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-16 22:11:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-16 22:11:47 +0200 |
commit | dda4144d39a9d685b8dda830978e7410bd372c40 (patch) | |
tree | 7044aa90183afff7fbf2cb141943c3812d6c2647 /src/memline.c | |
parent | eda652215abf696f86b872888945a2d2dd8c7192 (diff) | |
download | vim-git-dda4144d39a9d685b8dda830978e7410bd372c40.tar.gz |
patch 8.1.1335: listener callback is called after inserting textv8.1.1335
Problem: Listener callback is called after inserting text.
Solution: Flush the changes before inserting or deleting a line. Store
changes per buffer.
Diffstat (limited to 'src/memline.c')
-rw-r--r-- | src/memline.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/memline.c b/src/memline.c index 812d10dc1..006a8b52d 100644 --- a/src/memline.c +++ b/src/memline.c @@ -2790,6 +2790,12 @@ ml_append_int( if (len == 0) len = (colnr_T)STRLEN(line) + 1; // space needed for the text +#ifdef FEAT_EVAL + // When inserting above recorded changes: flush the changes before changing + // the text. + may_invoke_listeners(buf, lnum + 1, lnum + 1, 1); +#endif + #ifdef FEAT_TEXT_PROP if (curbuf->b_has_textprop && lnum > 0) // Add text properties that continue from the previous line. @@ -3526,6 +3532,11 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message) 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--; |