diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-02 23:47:18 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-02 23:47:18 +0100 |
commit | 196d157f12cf0476d97f78834155fc67d6b161de (patch) | |
tree | 3deba5b00cb3d25d69ae887a3491dde66096ac19 /src/edit.c | |
parent | 33c8ca923ed6d5638fa98afabb2e25b5056dd47b (diff) |
patch 8.1.0682: text properties not adjusted when backspacing replaced textv8.1.0682
Problem: Text properties are not adjusted when backspacing replaced text.
Solution: Keep text properties on text restored in replace mode.
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/edit.c b/src/edit.c index 1b88f6140a..65f2bb1e7d 100644 --- a/src/edit.c +++ b/src/edit.c @@ -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); |