mch_memmove(newp + newlen + 1, oldp + oldlen + 1,
(size_t)curbuf->b_ml.ml_line_len - oldlen - 1);
curbuf->b_ml.ml_line_len -= count;
+ curbuf->b_ml.ml_line_textlen = (int)STRLEN(newp) + 1;
}
#endif
vim_free(curbuf->b_ml.ml_line_ptr);
curbuf->b_ml.ml_line_ptr = newp;
curbuf->b_ml.ml_line_len -= i;
+ curbuf->b_ml.ml_line_textlen = (int)STRLEN(newp) + 1;
curbuf->b_ml.ml_flags =
(curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY;
}
if (*ml_get_buf(buf, lnum, FALSE) == NUL)
return 0;
- return buf->b_ml.ml_line_len - 1;
+ return buf->b_ml.ml_line_textlen - 1;
}
/*
errorret:
STRCPY(questions, "???");
buf->b_ml.ml_line_len = 4;
+ buf->b_ml.ml_line_textlen = buf->b_ml.ml_line_len;
buf->b_ml.ml_line_lnum = lnum;
return questions;
}
if (buf->b_ml.ml_mfp == NULL) // there are no lines
{
buf->b_ml.ml_line_len = 1;
+ buf->b_ml.ml_line_textlen = buf->b_ml.ml_line_len;
return (char_u *)"";
}
buf->b_ml.ml_line_ptr = (char_u *)dp + start;
buf->b_ml.ml_line_len = end - start;
+#if defined(FEAT_BYTEOFF) && defined(FEAT_PROP_POPUP)
+ if (buf->b_has_textprop)
+ buf->b_ml.ml_line_textlen = (int)STRLEN(buf->b_ml.ml_line_ptr) + 1;
+ else
+#endif
+ buf->b_ml.ml_line_textlen = buf->b_ml.ml_line_len;
buf->b_ml.ml_line_lnum = lnum;
buf->b_ml.ml_flags &= ~(ML_LINE_DIRTY | ML_ALLOCATED);
}
curbuf->b_ml.ml_line_ptr = line;
curbuf->b_ml.ml_line_len = len;
+ curbuf->b_ml.ml_line_textlen = len_arg + 1;
curbuf->b_ml.ml_line_lnum = lnum;
curbuf->b_ml.ml_flags = (curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY;
#define ML_ALLOCATED 0x10 // ml_line_ptr is an allocated copy
int ml_flags;
- colnr_T ml_line_len; // length of the cached line, including NUL
+ colnr_T ml_line_len; // length of the cached line + textproperties, including NUL
+ colnr_T ml_line_textlen;// length of the cached line, including NUL
linenr_T ml_line_lnum; // line number of cached line, 0 if not valid
char_u *ml_line_ptr; // pointer to cached line