comparison src/edit.c @ 15349:6abee072b93c v8.1.0682

patch 8.1.0682: text properties not adjusted when backspacing replaced text commit https://github.com/vim/vim/commit/196d157f12cf0476d97f78834155fc67d6b161de Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 2 23:47:18 2019 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Thu, 03 Jan 2019 00:00:54 +0100
parents f6b522596993
children 88b0a490816e
comparison
equal deleted inserted replaced
15348:24c31bd03f3a 15349:6abee072b93c
7960 int vcol; 7960 int vcol;
7961 7961
7962 cc = replace_pop(); 7962 cc = replace_pop();
7963 if (cc > 0) 7963 if (cc > 0)
7964 { 7964 {
7965 #ifdef FEAT_TEXT_PROP
7966 size_t len_before;
7967
7968 if (curbuf->b_has_textprop)
7969 {
7970 // Do not adjust text properties for individual delete and insert
7971 // operations, do it afterwards on the resulting text.
7972 len_before = STRLEN(ml_get_curline());
7973 ++text_prop_frozen;
7974 }
7975 #endif
7965 if (State & VREPLACE_FLAG) 7976 if (State & VREPLACE_FLAG)
7966 { 7977 {
7967 /* Get the number of screen cells used by the character we are 7978 /* Get the number of screen cells used by the character we are
7968 * going to delete. */ 7979 * going to delete. */
7969 getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL); 7980 getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
8010 ++orig_vcols; 8021 ++orig_vcols;
8011 } 8022 }
8012 curwin->w_cursor.col -= ins_len; 8023 curwin->w_cursor.col -= ins_len;
8013 } 8024 }
8014 8025
8015 /* mark the buffer as changed and prepare for displaying */ 8026 // mark the buffer as changed and prepare for displaying
8016 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col); 8027 changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
8028
8029 #ifdef FEAT_TEXT_PROP
8030 if (curbuf->b_has_textprop)
8031 {
8032 size_t len_now = STRLEN(ml_get_curline());
8033
8034 --text_prop_frozen;
8035 adjust_prop_columns(curwin->w_cursor.lnum, curwin->w_cursor.col,
8036 (int)(len_now - len_before));
8037 }
8038 #endif
8017 } 8039 }
8018 else if (cc == 0) 8040 else if (cc == 0)
8019 (void)del_char_after_col(limit_col); 8041 (void)del_char_after_col(limit_col);
8020 } 8042 }
8021 8043