" Same, but delete four columns
call RunTestVisualBlock(4, '02')
endfunc
+
+" Adding a text property to a new buffer should not fail
+func Test_textprop_empty_buffer()
+ call prop_type_add('comment', {'highlight': 'Search'})
+ new
+ call prop_add(1, 1, {'type': 'comment'})
+ close
+endfunc
*
* TODO:
* - Adjust text property column and length when text is inserted/deleted.
+ * -> :substitute with multiple matches, issue #4427
* -> a :substitute with a multi-line match
* -> search for changed_bytes() from misc1.c
* -> search for mark_col_adjust()
return;
}
+ if (buf->b_ml.ml_mfp == NULL)
+ ml_open(buf);
+
for (lnum = start_lnum; lnum <= end_lnum; ++lnum)
{
colnr_T col; // start column
// Be quick when no text property types have been defined or the buffer,
// unless we are adding one.
- if (!buf->b_has_textprop && !will_change)
+ if ((!buf->b_has_textprop && !will_change) || buf->b_ml.ml_mfp == NULL)
return 0;
// Fetch the line to get the ml_line_len field updated.