0
0
mirror of https://github.com/vim/vim.git synced 2025-10-06 05:44:14 -04:00

patch 8.2.0669: MS-Windows: display in VTP is a bit slow

Problem:    MS-Windows: display in VTP is a bit slow.
Solution:   Optimize the code. (Nobuhiro Takasaki, closes #6014)
This commit is contained in:
Bram Moolenaar
2020-04-30 20:59:57 +02:00
parent 7f6f56f43c
commit 4e5534fab7
3 changed files with 387 additions and 51 deletions

View File

@@ -1880,6 +1880,9 @@ screen_start_highlight(int attr)
screen_stop_highlight(void)
{
int do_ME = FALSE; // output T_ME code
#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
int do_ME_fg, do_ME_bg;
#endif
if (screen_attr != 0
#ifdef MSWIN
@@ -1913,16 +1916,42 @@ screen_stop_highlight(void)
#ifdef FEAT_TERMGUICOLORS
p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR
? aep->ae_u.cterm.fg_rgb != INVALCOLOR
# ifdef FEAT_VTP
? !(do_ME_fg = TRUE) : (do_ME_fg = FALSE)
# endif
:
#endif
aep->ae_u.cterm.fg_color) || (
#ifdef FEAT_TERMGUICOLORS
p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR
? aep->ae_u.cterm.bg_rgb != INVALCOLOR
# ifdef FEAT_VTP
? !(do_ME_bg = TRUE) : (do_ME_bg = FALSE)
# endif
:
#endif
aep->ae_u.cterm.bg_color)))
do_ME = TRUE;
#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
if (use_vtp())
{
if (do_ME_fg && do_ME_bg)
do_ME = TRUE;
// FG and BG cannot be separated in T_ME, which is not
// efficient.
if (!do_ME && do_ME_fg)
out_str((char_u *)"\033|39m"); // restore FG
if (!do_ME && do_ME_bg)
out_str((char_u *)"\033|49m"); // restore BG
}
else
{
// Process FG and BG at once.
if (!do_ME)
do_ME = do_ME_fg | do_ME_bg;
}
#endif
}
else
{