Mercurial > vim
comparison src/screen.c @ 20227:f2e4c12b24b3 v8.2.0669
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Commit: https://github.com/vim/vim/commit/4e5534fab798ab7c95554da3bc80b08336aedc2b
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 30 20:59:57 2020 +0200
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 https://github.com/vim/vim/issues/6014)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 30 Apr 2020 21:15:04 +0200 |
parents | 5dc9b96e3c5a |
children | 9620ab71f4f3 |
comparison
equal
deleted
inserted
replaced
20226:6ffcab677df2 | 20227:f2e4c12b24b3 |
---|---|
1878 | 1878 |
1879 void | 1879 void |
1880 screen_stop_highlight(void) | 1880 screen_stop_highlight(void) |
1881 { | 1881 { |
1882 int do_ME = FALSE; // output T_ME code | 1882 int do_ME = FALSE; // output T_ME code |
1883 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) | |
1884 int do_ME_fg, do_ME_bg; | |
1885 #endif | |
1883 | 1886 |
1884 if (screen_attr != 0 | 1887 if (screen_attr != 0 |
1885 #ifdef MSWIN | 1888 #ifdef MSWIN |
1886 && termcap_active | 1889 && termcap_active |
1887 #endif | 1890 #endif |
1911 aep = syn_cterm_attr2entry(screen_attr); | 1914 aep = syn_cterm_attr2entry(screen_attr); |
1912 if (aep != NULL && (( | 1915 if (aep != NULL && (( |
1913 #ifdef FEAT_TERMGUICOLORS | 1916 #ifdef FEAT_TERMGUICOLORS |
1914 p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR | 1917 p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR |
1915 ? aep->ae_u.cterm.fg_rgb != INVALCOLOR | 1918 ? aep->ae_u.cterm.fg_rgb != INVALCOLOR |
1919 # ifdef FEAT_VTP | |
1920 ? !(do_ME_fg = TRUE) : (do_ME_fg = FALSE) | |
1921 # endif | |
1916 : | 1922 : |
1917 #endif | 1923 #endif |
1918 aep->ae_u.cterm.fg_color) || ( | 1924 aep->ae_u.cterm.fg_color) || ( |
1919 #ifdef FEAT_TERMGUICOLORS | 1925 #ifdef FEAT_TERMGUICOLORS |
1920 p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR | 1926 p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR |
1921 ? aep->ae_u.cterm.bg_rgb != INVALCOLOR | 1927 ? aep->ae_u.cterm.bg_rgb != INVALCOLOR |
1928 # ifdef FEAT_VTP | |
1929 ? !(do_ME_bg = TRUE) : (do_ME_bg = FALSE) | |
1930 # endif | |
1922 : | 1931 : |
1923 #endif | 1932 #endif |
1924 aep->ae_u.cterm.bg_color))) | 1933 aep->ae_u.cterm.bg_color))) |
1925 do_ME = TRUE; | 1934 do_ME = TRUE; |
1935 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) | |
1936 if (use_vtp()) | |
1937 { | |
1938 if (do_ME_fg && do_ME_bg) | |
1939 do_ME = TRUE; | |
1940 | |
1941 // FG and BG cannot be separated in T_ME, which is not | |
1942 // efficient. | |
1943 if (!do_ME && do_ME_fg) | |
1944 out_str((char_u *)"\033|39m"); // restore FG | |
1945 if (!do_ME && do_ME_bg) | |
1946 out_str((char_u *)"\033|49m"); // restore BG | |
1947 } | |
1948 else | |
1949 { | |
1950 // Process FG and BG at once. | |
1951 if (!do_ME) | |
1952 do_ME = do_ME_fg | do_ME_bg; | |
1953 } | |
1954 #endif | |
1926 } | 1955 } |
1927 else | 1956 else |
1928 { | 1957 { |
1929 aep = syn_term_attr2entry(screen_attr); | 1958 aep = syn_term_attr2entry(screen_attr); |
1930 if (aep != NULL && aep->ae_u.term.stop != NULL) | 1959 if (aep != NULL && aep->ae_u.term.stop != NULL) |