diff src/charset.c @ 29583:32aee589fc9a v9.0.0132

patch 9.0.0132: multi-byte characters in virtual text not handled correctly Commit: https://github.com/vim/vim/commit/09ff4b54fb86a64390ba9c609853c6410ea6197c Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 1 16:51:02 2022 +0100 patch 9.0.0132: multi-byte characters in virtual text not handled correctly Problem: Multi-byte characters in virtual text not handled correctly. Solution: Count screen cells instead of bytes.
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Aug 2022 18:00:05 +0200
parents 24f01baa27b2
children 5233acfa06f1
line wrap: on
line diff
--- a/src/charset.c
+++ b/src/charset.c
@@ -1097,9 +1097,8 @@ win_lbr_chartabsize(
 	    {
 		char_u *p = ((char_u **)wp->w_buffer->b_textprop_text.ga_data)[
 							       -tp->tp_id - 1];
-		int len = (int)STRLEN(p);
+		int len = vim_strsize(p);
 
-		// TODO: count screen cells
 		if (tp->tp_col == MAXCOL)
 		{
 		    // TODO: truncating
@@ -1454,8 +1453,9 @@ getvcol(
     if (cursor != NULL)
     {
 #ifdef FEAT_PROP_POPUP
-	// cursor is after inserted text
-	vcol += cts.cts_cur_text_width;
+	if ((State & MODE_INSERT) == 0)
+	    // cursor is after inserted text
+	    vcol += cts.cts_cur_text_width;
 #endif
 	if (*ptr == TAB
 		&& (State & MODE_NORMAL)