0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.0682: text properties not adjusted when backspacing replaced text

Problem:    Text properties are not adjusted when backspacing replaced text.
Solution:   Keep text properties on text restored in replace mode.
This commit is contained in:
Bram Moolenaar
2019-01-02 23:47:18 +01:00
parent 33c8ca923e
commit 196d157f12
5 changed files with 98 additions and 21 deletions

View File

@@ -7962,6 +7962,17 @@ replace_do_bs(int limit_col)
cc = replace_pop();
if (cc > 0)
{
#ifdef FEAT_TEXT_PROP
size_t len_before;
if (curbuf->b_has_textprop)
{
// Do not adjust text properties for individual delete and insert
// operations, do it afterwards on the resulting text.
len_before = STRLEN(ml_get_curline());
++text_prop_frozen;
}
#endif
if (State & VREPLACE_FLAG)
{
/* Get the number of screen cells used by the character we are
@@ -8012,8 +8023,19 @@ replace_do_bs(int limit_col)
curwin->w_cursor.col -= ins_len;
}
/* mark the buffer as changed and prepare for displaying */
// mark the buffer as changed and prepare for displaying
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
#ifdef FEAT_TEXT_PROP
if (curbuf->b_has_textprop)
{
size_t len_now = STRLEN(ml_get_curline());
--text_prop_frozen;
adjust_prop_columns(curwin->w_cursor.lnum, curwin->w_cursor.col,
(int)(len_now - len_before));
}
#endif
}
else if (cc == 0)
(void)del_char_after_col(limit_col);