summaryrefslogtreecommitdiff
path: root/src/memline.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-25 16:40:03 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-25 16:40:03 +0200
commitcdd8a5e6fe089a3b1370ac940d06fc3cefc6f8f2 (patch)
tree10f350717f6d85b661fcd8124bc57c69cc6e4797 /src/memline.c
parent5ca5cc6412d7d68fd380926f9551a8b7ba335199 (diff)
downloadvim-git-cdd8a5e6fe089a3b1370ac940d06fc3cefc6f8f2.tar.gz
patch 8.2.3372: line2byte() value wrong when adding a text propertyv8.2.3372
Problem: line2byte() value wrong when adding a text property. (Yuto Kimura) Solution: Adjust length for text property. (closes #8772) Also fix it for deleting a line.
Diffstat (limited to 'src/memline.c')
-rw-r--r--src/memline.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/memline.c b/src/memline.c
index 5aeee900f..2192036ed 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -3251,9 +3251,15 @@ ml_append_int(
}
#ifdef FEAT_BYTEOFF
+# ifdef FEAT_PROP_POPUP
+ if (curbuf->b_has_textprop)
+ // only use the space needed for the text, ignore properties
+ len = (colnr_T)STRLEN(line) + 1;
+# endif
// The line was inserted below 'lnum'
ml_updatechunk(buf, lnum + 1, (long)len, ML_CHNK_ADDLINE);
#endif
+
#ifdef FEAT_NETBEANS_INTG
if (netbeans_active())
{
@@ -3752,7 +3758,11 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int flags)
}
#ifdef FEAT_BYTEOFF
- ml_updatechunk(buf, lnum, line_size, ML_CHNK_DELLINE);
+ ml_updatechunk(buf, lnum, line_size
+# ifdef FEAT_PROP_POPUP
+ - textprop_save_len
+# endif
+ , ML_CHNK_DELLINE);
#endif
ret = OK;