diff src/popupwin.c @ 17320:33dccaafb214 v8.1.1659

patch 8.1.1659: popup window "mousemoved" values not correct commit https://github.com/vim/vim/commit/b05caa782dbab51db8de60940eff7992f8cfd882 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 10 21:55:54 2019 +0200 patch 8.1.1659: popup window "mousemoved" values not correct Problem: Popup window "mousemoved" values not correct. Solution: Convert text column to mouse column.
author Bram Moolenaar <Bram@vim.org>
date Wed, 10 Jul 2019 22:00:04 +0200
parents a7d1cd2ea886
children 12c1f01b304e
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -184,14 +184,24 @@ set_mousemoved_values(win_T *wp)
     static void
 set_mousemoved_columns(win_T *wp, int flags)
 {
+    win_T	*textwp;
     char_u	*text;
     int		col;
+    pos_T	pos;
+    colnr_T	mcol;
 
     if (find_word_under_cursor(mouse_row, mouse_col, TRUE, flags,
-					 NULL, NULL, &text, NULL, &col) == OK)
+				  &textwp, &pos.lnum, &text, NULL, &col) == OK)
     {
-	wp->w_popup_mouse_mincol = col;
-	wp->w_popup_mouse_maxcol = col + STRLEN(text) - 1;
+	// convert text column to mouse column
+	pos.col = col;
+	pos.coladd = 0;
+	getvcol(textwp, &pos, &mcol, NULL, NULL);
+	wp->w_popup_mouse_mincol = mcol;
+
+	pos.col = col + STRLEN(text) - 1;
+	getvcol(textwp, &pos, NULL, NULL, &mcol);
+	wp->w_popup_mouse_maxcol = mcol;
 	vim_free(text);
     }
 }