vim-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".
7ba343e634
This commit is contained in:
Jan Edmund Lazo
2020-12-18 22:24:57 -05:00
parent b35061fb64
commit 945ae2c72b

View File

@@ -3052,57 +3052,57 @@ static bool find_is_eval_item(
return false; return false;
} }
/* // Find the identifier under or to the right of the cursor.
* Find the identifier under or to the right of the cursor. // "find_type" can have one of three values:
* "find_type" can have one of three values: // FIND_IDENT: find an identifier (keyword)
* FIND_IDENT: find an identifier (keyword) // FIND_STRING: find any non-white text
* FIND_STRING: find any non-white string // FIND_IDENT + FIND_STRING: find any non-white text, identifier preferred.
* FIND_IDENT + FIND_STRING: find any non-white string, identifier preferred. // FIND_EVAL: find text useful for C program debugging
* FIND_EVAL: find text useful for C program debugging //
* // There are three steps:
* There are three steps: // 1. Search forward for the start of an identifier/text. Doesn't move if
* 1. Search forward for the start of an identifier/string. Doesn't move if // already on one.
* already on one. // 2. Search backward for the start of this identifier/text.
* 2. Search backward for the start of this identifier/string. // This doesn't match the real Vi but I like it a little better and it
* This doesn't match the real Vi but I like it a little better and it // shouldn't bother anyone.
* shouldn't bother anyone. // 3. Search forward to the end of this identifier/text.
* 3. Search forward to the end of this identifier/string. // When FIND_IDENT isn't defined, we backup until a blank.
* When FIND_IDENT isn't defined, we backup until a blank. //
* // Returns the length of the text, or zero if no text is found.
* Returns the length of the string, or zero if no string is found. // If text is found, a pointer to the text is put in "*text". This
* If a string is found, a pointer to the string is put in "*string". This // points into the current buffer line and is not always NUL terminated.
* string is not always NUL terminated. size_t find_ident_under_cursor(char_u **text, int find_type)
*/ FUNC_ATTR_NONNULL_ARG(1)
size_t find_ident_under_cursor(char_u **string, int find_type)
{ {
return find_ident_at_pos(curwin, curwin->w_cursor.lnum, return find_ident_at_pos(curwin, curwin->w_cursor.lnum,
curwin->w_cursor.col, string, find_type); curwin->w_cursor.col, text, NULL, find_type);
} }
/* /*
* Like find_ident_under_cursor(), but for any window and any position. * Like find_ident_under_cursor(), but for any window and any position.
* However: Uses 'iskeyword' from the current window!. * However: Uses 'iskeyword' from the current window!.
*/ */
size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, size_t find_ident_at_pos(
char_u **string, int find_type) win_T *wp,
linenr_T lnum,
colnr_T startcol,
char_u **text,
int *textcol, // column where "text" starts, can be NULL
int find_type)
FUNC_ATTR_NONNULL_ARG(1, 4)
{ {
char_u *ptr; int col = 0; // init to shut up GCC
int col = 0; /* init to shut up GCC */
int i; int i;
int this_class = 0; int this_class = 0;
int prev_class; int prev_class;
int prevcol; int prevcol;
int bn = 0; // bracket nesting int bn = 0; // bracket nesting
/* // if i == 0: try to find an identifier
* if i == 0: try to find an identifier // if i == 1: try to find any non-white text
* if i == 1: try to find any non-white string char_u *ptr = ml_get_buf(wp->w_buffer, lnum, false);
*/ for (i = (find_type & FIND_IDENT) ? 0 : 1; i < 2; i++) {
ptr = ml_get_buf(wp->w_buffer, lnum, false); // 1. skip to start of identifier/text
for (i = (find_type & FIND_IDENT) ? 0 : 1; i < 2; ++i) {
/*
* 1. skip to start of identifier/string
*/
col = startcol; col = startcol;
while (ptr[col] != NUL) { while (ptr[col] != NUL) {
// Stop at a ']' to evaluate "a[x]". // Stop at a ']' to evaluate "a[x]".
@@ -3120,7 +3120,7 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol,
bn = ptr[col] == ']'; bn = ptr[col] == ']';
// //
// 2. Back up to start of identifier/string. // 2. Back up to start of identifier/text.
// //
// Remember class of character under cursor. // Remember class of character under cursor.
if ((find_type & FIND_EVAL) && ptr[col] == ']') { if ((find_type & FIND_EVAL) && ptr[col] == ']') {
@@ -3143,7 +3143,7 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol,
col = prevcol; col = prevcol;
} }
// If we don't want just any old string, or we've found an // If we don't want just any old text, or we've found an
// identifier, stop searching. // identifier, stop searching.
if (this_class > 2) { if (this_class > 2) {
this_class = 2; this_class = 2;
@@ -3154,7 +3154,7 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol,
} }
if (ptr[col] == NUL || (i == 0 && this_class != 2)) { if (ptr[col] == NUL || (i == 0 && this_class != 2)) {
// Didn't find an identifier or string. // Didn't find an identifier or text.
if (find_type & FIND_STRING) { if (find_type & FIND_STRING) {
EMSG(_("E348: No string under cursor")); EMSG(_("E348: No string under cursor"));
} else { } else {
@@ -3163,11 +3163,12 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol,
return 0; return 0;
} }
ptr += col; ptr += col;
*string = ptr; *text = ptr;
if (textcol != NULL) {
*textcol = col;
}
/* // 3. Find the end if the identifier/text.
* 3. Find the end if the identifier/string.
*/
bn = 0; bn = 0;
startcol -= col; startcol -= col;
col = 0; col = 0;