summaryrefslogtreecommitdiffstats
path: root/src/charset.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-08 11:07:47 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-08 11:07:47 +0100
commit25463610dfc7a4984f70b030463fb98b09772ad9 (patch)
tree3f0669adf485a5a8b00c48c036ad8a14fcce86de /src/charset.c
parent38ea2733b4dd8e9bfc4a5bb5c11cb661bf000c4e (diff)
patch 9.0.0168: cursor positioned wrong with two virtual text propertiesv9.0.0168
Problem: Cursor positioned wrong with two virtual text properties close together. (Ben Jackson) Solution: Add the original size, not the computed one. (closes #10864)
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/charset.c b/src/charset.c
index 27213e93a9..7a18a97d41 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1130,6 +1130,7 @@ win_lbr_chartabsize(
# ifdef FEAT_PROP_POPUP
if (cts->cts_has_prop_with_text && *line != NUL)
{
+ int normal_size = size;
int i;
int col = (int)(s - line);
garray_T *gap = &wp->w_buffer->b_textprop_text;
@@ -1141,7 +1142,8 @@ win_lbr_chartabsize(
// Watch out for the text being deleted. "cts_text_props" is a
// copy, the text prop may actually have been removed from the line.
if (tp->tp_id < 0
- && ((tp->tp_col - 1 >= col && tp->tp_col - 1 < col + size)
+ && ((tp->tp_col - 1 >= col
+ && tp->tp_col - 1 < col + normal_size)
|| (tp->tp_col == MAXCOL && (s[0] == NUL || s[1] == NUL)
&& cts->cts_with_trailing))
&& -tp->tp_id - 1 < gap->ga_len)
@@ -1152,7 +1154,6 @@ win_lbr_chartabsize(
{
int cells = vim_strsize(p);
- added = wp->w_width - (vcol + size) % wp->w_width;
if (tp->tp_col == MAXCOL)
{
int below = (tp->tp_flags & TP_FLAG_ALIGN_BELOW);
@@ -1163,8 +1164,11 @@ win_lbr_chartabsize(
// Keep in sync with where textprop_size_after_trunc()
// is called in win_line().
if (!wrap)
+ {
+ added = wp->w_width - (vcol + size) % wp->w_width;
cells = textprop_size_after_trunc(wp,
below, added, p, &n_used);
+ }
// right-aligned does not really matter here, same as
// "after"
if (below)