diff src/beval.c @ 17316:8813e1626e0a v8.1.1657

patch 8.1.1657: Terminal: screen updates from 'balloonexpr' are not displayed commit https://github.com/vim/vim/commit/7ba343e63483b09584d4bf5a997fc1d1c09f19f7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jul 9 23:22:15 2019 +0200 patch 8.1.1657: Terminal: screen updates from 'balloonexpr' are not displayed Problem: Terminal: screen updates from 'balloonexpr' are not displayed. Solution: Update the screen if needed. Fix the word position for "mousemoved".
author Bram Moolenaar <Bram@vim.org>
date Tue, 09 Jul 2019 23:30:05 +0200
parents 1b0b90f1d95e
children 6f15977fb40e
line wrap: on
line diff
--- a/src/beval.c
+++ b/src/beval.c
@@ -27,10 +27,12 @@ find_word_under_cursor(
 	win_T	    **winp,	// can be NULL
 	linenr_T    *lnump,	// can be NULL
 	char_u	    **textp,
-	int	    *colp)
+	int	    *colp,	// column where mouse hovers, can be NULL
+	int	    *startcolp) // column where text starts, can be NULL
 {
     int		row = mouserow;
     int		col = mousecol;
+    int		scol;
     win_T	*wp;
     char_u	*lbuf;
     linenr_T	lnum;
@@ -98,8 +100,8 @@ find_word_under_cursor(
 		    {
 			// Find the word under the cursor.
 			++emsg_off;
-			len = find_ident_at_pos(wp, lnum, (colnr_T)col, &lbuf,
-									flags);
+			len = find_ident_at_pos(wp, lnum, (colnr_T)col,
+							  &lbuf, &scol, flags);
 			--emsg_off;
 			if (len == 0)
 			    return FAIL;
@@ -112,7 +114,10 @@ find_word_under_cursor(
 		if (lnump != NULL)
 		    *lnump = lnum;
 		*textp = lbuf;
-		*colp = col;
+		if (colp != NULL)
+		    *colp = col;
+		if (startcolp != NULL)
+		    *startcolp = scol;
 		return OK;
 	    }
 	}
@@ -150,7 +155,7 @@ get_beval_info(
 #endif
     if (find_word_under_cursor(row, col, getword,
 		FIND_IDENT + FIND_STRING + FIND_EVAL,
-		winp, lnump, textp, colp) == OK)
+		winp, lnump, textp, colp, NULL) == OK)
     {
 #ifdef FEAT_VARTABS
 	vim_free(beval->vts);
@@ -296,12 +301,10 @@ general_beval_cb(BalloonEval *beval, int
 	    if (result != NULL && result[0] != NUL)
 		post_balloon(beval, result, NULL);
 
-# ifdef FEAT_GUI
 	    // The 'balloonexpr' evaluation may show something on the screen
 	    // that requires a screen update.
-	    if (gui.in_use && must_redraw)
+	    if (must_redraw)
 		redraw_after_callback(FALSE);
-# endif
 
 	    recursive = FALSE;
 	    return;