0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.1995: the popup menu can cause too much redrawing

Problem:    The popup menu can cause too much redrawing.
Solution:   Reduce the length of the displayed text. (Yasuhiro Matsumoto,
            closes #7306)
This commit is contained in:
Bram Moolenaar
2020-11-16 19:12:00 +01:00
parent c4390fe6c0
commit 714cbe5b21
2 changed files with 21 additions and 5 deletions

View File

@@ -361,6 +361,8 @@ pum_display(
// redo the positioning. Limit this to two times, when there is not // redo the positioning. Limit this to two times, when there is not
// much room the window size will keep changing. // much room the window size will keep changing.
} while (pum_set_selected(selected, redo_count) && ++redo_count <= 2); } while (pum_set_selected(selected, redo_count) && ++redo_count <= 2);
pum_redraw();
} }
/* /*
@@ -541,8 +543,23 @@ pum_redraw(void)
{ {
if (st != NULL) if (st != NULL)
{ {
screen_puts_len(st, (int)STRLEN(st), row, col, int size = (int)STRLEN(st);
attr); int cells = (*mb_string2cells)(st, size);
// only draw the text that fits
while (size > 0
&& col + cells > pum_width + pum_col)
{
--size;
if (has_mbyte)
{
size -= (*mb_head_off)(st, st + size);
cells -= (*mb_ptr2cells)(st + size);
}
else
--cells;
}
screen_puts_len(st, size, row, col, attr);
vim_free(st); vim_free(st);
} }
col += width; col += width;
@@ -990,9 +1007,6 @@ pum_set_selected(int n, int repeat UNUSED)
popup_hide_info(); popup_hide_info();
#endif #endif
if (!resized)
pum_redraw();
return resized; return resized;
} }

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1995,
/**/ /**/
1994, 1994,
/**/ /**/