diff src/drawline.c @ 29918:e6e0f1c39edb v9.0.0297

patch 9.0.0297: cursor position wrong after right aligned virtual text Commit: https://github.com/vim/vim/commit/c8bf59e9b27f9d621818ffc61468abef45cedf37 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 28 16:39:22 2022 +0100 patch 9.0.0297: cursor position wrong after right aligned virtual text Problem: Cursor position wrong after right aligned virtual text. (Iizuka Masashi) Solution: Take the width of the column offset into account. (closes #10997) Also fix virtual text positioning.
author Bram Moolenaar <Bram@vim.org>
date Sun, 28 Aug 2022 17:45:03 +0200
parents bbe62ea78aac
children 4b9b237d1211
line wrap: on
line diff
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -302,6 +302,7 @@ text_prop_position(
     int	    padding = tp->tp_col == MAXCOL && tp->tp_len > 1
 				  ? tp->tp_len - 1 : 0;
     int	    col_with_padding = vcol + (below ? 0 : padding);
+    int	    col_off = 0;
     int	    room = wp->w_width - col_with_padding;
     int	    added = room;
     int	    n_used = *n_extra;
@@ -324,7 +325,8 @@ text_prop_position(
 	    if (right && (wrap || room < PROP_TEXT_MIN_CELLS))
 	    {
 		// right-align on next line instead of wrapping if possible
-		added = wp->w_width - strsize + room;
+		col_off = win_col_off(wp) + win_col_off2(wp);
+		added = wp->w_width - col_off - strsize + room;
 		if (added < 0)
 		    added = 0;
 		else
@@ -386,7 +388,7 @@ text_prop_position(
 		*p_extra = l;
 		*n_extra = n_used + added + padding;
 		*n_attr = mb_charlen(*p_extra);
-		*n_attr_skip = added + padding;
+		*n_attr_skip = added + padding + col_off;
 	    }
 	}
     }