mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 7.3.781
Problem: Drawing with 'guifontwide' can be slow. Solution: Draw multiple characters at a time. (Taro Muraoka)
This commit is contained in:
34
src/gui.c
34
src/gui.c
@@ -2380,7 +2380,9 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
|||||||
int cl; /* byte length of current char */
|
int cl; /* byte length of current char */
|
||||||
int comping; /* current char is composing */
|
int comping; /* current char is composing */
|
||||||
int scol = col; /* screen column */
|
int scol = col; /* screen column */
|
||||||
int dowide; /* use 'guifontwide' */
|
int curr_wide; /* use 'guifontwide' */
|
||||||
|
int prev_wide = FALSE;
|
||||||
|
int wide_changed;
|
||||||
|
|
||||||
/* Break the string at a composing character, it has to be drawn on
|
/* Break the string at a composing character, it has to be drawn on
|
||||||
* top of the previous character. */
|
* top of the previous character. */
|
||||||
@@ -2395,9 +2397,9 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
|||||||
&& fontset == NOFONTSET
|
&& fontset == NOFONTSET
|
||||||
# endif
|
# endif
|
||||||
&& gui.wide_font != NOFONT)
|
&& gui.wide_font != NOFONT)
|
||||||
dowide = TRUE;
|
curr_wide = TRUE;
|
||||||
else
|
else
|
||||||
dowide = FALSE;
|
curr_wide = FALSE;
|
||||||
comping = utf_iscomposing(c);
|
comping = utf_iscomposing(c);
|
||||||
if (!comping) /* count cells from non-composing chars */
|
if (!comping) /* count cells from non-composing chars */
|
||||||
cells += cn;
|
cells += cn;
|
||||||
@@ -2405,9 +2407,11 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
|||||||
if (cl == 0) /* hit end of string */
|
if (cl == 0) /* hit end of string */
|
||||||
len = i + cl; /* len must be wrong "cannot happen" */
|
len = i + cl; /* len must be wrong "cannot happen" */
|
||||||
|
|
||||||
/* print the string so far if it's the last character or there is
|
wide_changed = curr_wide != prev_wide;
|
||||||
|
|
||||||
|
/* Print the string so far if it's the last character or there is
|
||||||
* a composing character. */
|
* a composing character. */
|
||||||
if (i + cl >= len || (comping && i > start) || dowide
|
if (i + cl >= len || (comping && i > start) || wide_changed
|
||||||
# if defined(FEAT_GUI_X11)
|
# if defined(FEAT_GUI_X11)
|
||||||
|| (cn > 1
|
|| (cn > 1
|
||||||
# ifdef FEAT_XFONTSET
|
# ifdef FEAT_XFONTSET
|
||||||
@@ -2419,25 +2423,28 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
|||||||
# endif
|
# endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (comping || dowide)
|
if (comping || wide_changed)
|
||||||
thislen = i - start;
|
thislen = i - start;
|
||||||
else
|
else
|
||||||
thislen = i - start + cl;
|
thislen = i - start + cl;
|
||||||
if (thislen > 0)
|
if (thislen > 0)
|
||||||
{
|
{
|
||||||
|
if (prev_wide)
|
||||||
|
gui_mch_set_font(gui.wide_font);
|
||||||
gui_mch_draw_string(gui.row, scol, s + start, thislen,
|
gui_mch_draw_string(gui.row, scol, s + start, thislen,
|
||||||
draw_flags);
|
draw_flags);
|
||||||
|
if (prev_wide)
|
||||||
|
gui_mch_set_font(font);
|
||||||
start += thislen;
|
start += thislen;
|
||||||
}
|
}
|
||||||
scol += cells;
|
scol += cells;
|
||||||
cells = 0;
|
cells = 0;
|
||||||
if (dowide)
|
/* Adjust to not draw a character which width is changed
|
||||||
|
* against with last one. */
|
||||||
|
if (wide_changed && !comping)
|
||||||
{
|
{
|
||||||
gui_mch_set_font(gui.wide_font);
|
scol -= cn;
|
||||||
gui_mch_draw_string(gui.row, scol - cn,
|
cl = 0;
|
||||||
s + start, cl, draw_flags);
|
|
||||||
gui_mch_set_font(font);
|
|
||||||
start += cl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(FEAT_GUI_X11)
|
# if defined(FEAT_GUI_X11)
|
||||||
@@ -2447,7 +2454,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
|||||||
# ifdef FEAT_XFONTSET
|
# ifdef FEAT_XFONTSET
|
||||||
&& fontset == NOFONTSET
|
&& fontset == NOFONTSET
|
||||||
# endif
|
# endif
|
||||||
&& !dowide)
|
&& !wide_changed)
|
||||||
gui_mch_draw_string(gui.row, scol - 1, (char_u *)" ",
|
gui_mch_draw_string(gui.row, scol - 1, (char_u *)" ",
|
||||||
1, draw_flags);
|
1, draw_flags);
|
||||||
# endif
|
# endif
|
||||||
@@ -2465,6 +2472,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
|
|||||||
# endif
|
# endif
|
||||||
start = i + cl;
|
start = i + cl;
|
||||||
}
|
}
|
||||||
|
prev_wide = curr_wide;
|
||||||
}
|
}
|
||||||
/* The stuff below assumes "len" is the length in screen columns. */
|
/* The stuff below assumes "len" is the length in screen columns. */
|
||||||
len = scol - col;
|
len = scol - col;
|
||||||
|
@@ -725,6 +725,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 */
|
||||||
|
/**/
|
||||||
|
781,
|
||||||
/**/
|
/**/
|
||||||
780,
|
780,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user