diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-17 22:57:26 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-17 22:57:26 +0200 |
commit | 8055d17388736421d875dd4933c4c93d49a2ab58 (patch) | |
tree | 81ebca77b3ed10b02f42f8513c29b838ac7952fb /src/textprop.c | |
parent | 787880a86dbcb79cdf6e8241b1d99ac4a7acbc09 (diff) | |
download | vim-git-8055d17388736421d875dd4933c4c93d49a2ab58.tar.gz |
patch 8.1.1343: text properties not adjusted for Visual block mode deletev8.1.1343
Problem: Text properties not adjusted for Visual block mode delete.
Solution: Call adjust_prop_columns(). (closes #4384)
Diffstat (limited to 'src/textprop.c')
-rw-r--r-- | src/textprop.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/textprop.c b/src/textprop.c index 8c86d0143..94b4d6b82 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -957,7 +957,7 @@ clear_buf_prop_types(buf_T *buf) * shift by "bytes_added" (can be negative). * Note that "col" is zero-based, while tp_col is one-based. * Only for the current buffer. - * Called is expected to check b_has_textprop and "bytes_added" being non-zero. + * Caller is expected to check b_has_textprop and "bytes_added" being non-zero. */ void adjust_prop_columns( @@ -994,15 +994,28 @@ adjust_prop_columns( ? 2 : 1)) : (tmp_prop.tp_col > col + 1)) { - tmp_prop.tp_col += bytes_added; + if (tmp_prop.tp_col + bytes_added < col + 1) + { + tmp_prop.tp_len += (tmp_prop.tp_col - 1 - col) + bytes_added; + tmp_prop.tp_col = col + 1; + } + else + tmp_prop.tp_col += bytes_added; dirty = TRUE; + if (tmp_prop.tp_len <= 0) + continue; // drop this text property } else if (tmp_prop.tp_len > 0 && tmp_prop.tp_col + tmp_prop.tp_len > col + ((pt != NULL && (pt->pt_flags & PT_FLAG_INS_END_INCL)) ? 0 : 1)) { - tmp_prop.tp_len += bytes_added; + int after = col - bytes_added + - (tmp_prop.tp_col - 1 + tmp_prop.tp_len); + if (after > 0) + tmp_prop.tp_len += bytes_added + after; + else + tmp_prop.tp_len += bytes_added; dirty = TRUE; if (tmp_prop.tp_len <= 0) continue; // drop this text property |