summaryrefslogtreecommitdiffstats
path: root/src/memline.c
diff options
context:
space:
mode:
authorPaul Ollis <paul@cleversheep.org>2022-05-24 21:26:37 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-24 21:26:37 +0100
commit4c3d21acaa09d929e6afe10288babe1d0af3de35 (patch)
tree2dc8dcb057fdeb4ab2bd2398e460a1692a0ac519 /src/memline.c
parent78d52883e10d71f23ab72a3d8b9733b00da8c9ad (diff)
patch 8.2.5014: byte offsets are wrong when using text propertiesv8.2.5014
Problem: Byte offsets are wrong when using text properties. Solution: Make sure text properties do not affect the byte counts. (Paul Ollis, closes #10474)
Diffstat (limited to 'src/memline.c')
-rw-r--r--src/memline.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/memline.c b/src/memline.c
index 83344bcda5..83aa2c68d5 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -4004,6 +4004,8 @@ ml_flush_line(buf_T *buf)
{
#if defined(FEAT_BYTEOFF) && defined(FEAT_PROP_POPUP)
int old_prop_len = 0;
+ if (buf->b_has_textprop)
+ old_prop_len = old_len - (int)STRLEN(old_line) - 1;
#endif
// if the length changes and there are following lines
count = buf->b_ml.ml_locked_high - buf->b_ml.ml_locked_low + 1;
@@ -4023,10 +4025,6 @@ ml_flush_line(buf_T *buf)
// adjust free space
dp->db_free -= extra;
dp->db_txt_start -= extra;
-#if defined(FEAT_BYTEOFF) && defined(FEAT_PROP_POPUP)
- if (buf->b_has_textprop)
- old_prop_len = old_len - (int)STRLEN(new_line) - 1;
-#endif
// copy new line into the data block
mch_memmove(old_line - extra, new_line, (size_t)new_len);