Mercurial > vim
comparison src/screen.c @ 12510:7a887dccd13a
patch 8.0.1133: syntax timeout not used correctly
commit https://github.com/vim/vim/commit/f3d769a585040ac47f7054057758809024ef6377
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 22 13:44:56 2017 +0200
patch 8.0.1133: syntax timeout not used correctly
Problem: Syntax timeout not used correctly.
Solution: Do not pass the timeout to syntax_start() but set it explicitly.
(Yasuhiro Matsumoto, closes #2139)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 22 Sep 2017 13:45:05 +0200 |
parents | 3f16cf18386c |
children | 3ca08bf99396 |
comparison
equal
deleted
inserted
replaced
12509:1fd4594eb74a | 12510:7a887dccd13a |
---|---|
129 #ifdef FEAT_FOLDING | 129 #ifdef FEAT_FOLDING |
130 static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row); | 130 static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row); |
131 static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); | 131 static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); |
132 static void copy_text_attr(int off, char_u *buf, int len, int attr); | 132 static void copy_text_attr(int off, char_u *buf, int len, int attr); |
133 #endif | 133 #endif |
134 static int win_line(win_T *, linenr_T, int, int, int nochange, proftime_T *syntax_tm); | 134 static int win_line(win_T *, linenr_T, int, int, int nochange); |
135 static int char_needs_redraw(int off_from, int off_to, int cols); | 135 static int char_needs_redraw(int off_from, int off_to, int cols); |
136 static void draw_vsep_win(win_T *wp, int row); | 136 static void draw_vsep_win(win_T *wp, int row); |
137 #ifdef FEAT_STL_OPT | 137 #ifdef FEAT_STL_OPT |
138 static void redraw_custom_statusline(win_T *wp); | 138 static void redraw_custom_statusline(win_T *wp); |
139 #endif | 139 #endif |
928 && foldedCount(wp, lnum, &win_foldinfo) == 0) | 928 && foldedCount(wp, lnum, &win_foldinfo) == 0) |
929 { | 929 { |
930 #ifdef SYN_TIME_LIMIT | 930 #ifdef SYN_TIME_LIMIT |
931 /* Set the time limit to 'redrawtime'. */ | 931 /* Set the time limit to 'redrawtime'. */ |
932 profile_setlimit(p_rdt, &syntax_tm); | 932 profile_setlimit(p_rdt, &syntax_tm); |
933 syn_set_timeout(&syntax_tm); | |
933 #endif | 934 #endif |
934 update_prepare(); | 935 update_prepare(); |
935 | 936 |
936 row = 0; | 937 row = 0; |
937 for (j = 0; j < wp->w_lines_valid; ++j) | 938 for (j = 0; j < wp->w_lines_valid; ++j) |
942 # ifdef FEAT_SEARCH_EXTRA | 943 # ifdef FEAT_SEARCH_EXTRA |
943 init_search_hl(wp); | 944 init_search_hl(wp); |
944 start_search_hl(); | 945 start_search_hl(); |
945 prepare_search_hl(wp, lnum); | 946 prepare_search_hl(wp, lnum); |
946 # endif | 947 # endif |
947 win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE, | 948 win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE); |
948 #ifdef SYN_TIME_LIMIT | |
949 &syntax_tm | |
950 #else | |
951 NULL | |
952 #endif | |
953 ); | |
954 # if defined(FEAT_SEARCH_EXTRA) | 949 # if defined(FEAT_SEARCH_EXTRA) |
955 end_search_hl(); | 950 end_search_hl(); |
956 # endif | 951 # endif |
957 break; | 952 break; |
958 } | 953 } |
959 row += wp->w_lines[j].wl_size; | 954 row += wp->w_lines[j].wl_size; |
960 } | 955 } |
961 | 956 |
962 update_finish(); | 957 update_finish(); |
958 | |
959 #ifdef SYN_TIME_LIMIT | |
960 syn_set_timeout(NULL); | |
961 #endif | |
963 } | 962 } |
964 need_cursor_line_redraw = FALSE; | 963 need_cursor_line_redraw = FALSE; |
965 } | 964 } |
966 #endif | 965 #endif |
967 | 966 |
1803 got_int = 0; | 1802 got_int = 0; |
1804 #endif | 1803 #endif |
1805 #ifdef SYN_TIME_LIMIT | 1804 #ifdef SYN_TIME_LIMIT |
1806 /* Set the time limit to 'redrawtime'. */ | 1805 /* Set the time limit to 'redrawtime'. */ |
1807 profile_setlimit(p_rdt, &syntax_tm); | 1806 profile_setlimit(p_rdt, &syntax_tm); |
1807 syn_set_timeout(&syntax_tm); | |
1808 #endif | 1808 #endif |
1809 #ifdef FEAT_FOLDING | 1809 #ifdef FEAT_FOLDING |
1810 win_foldinfo.fi_level = 0; | 1810 win_foldinfo.fi_level = 0; |
1811 #endif | 1811 #endif |
1812 | 1812 |
2107 #endif | 2107 #endif |
2108 | 2108 |
2109 /* | 2109 /* |
2110 * Display one line. | 2110 * Display one line. |
2111 */ | 2111 */ |
2112 row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0, | 2112 row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0); |
2113 #ifdef SYN_TIME_LIMIT | |
2114 &syntax_tm | |
2115 #else | |
2116 NULL | |
2117 #endif | |
2118 ); | |
2119 | 2113 |
2120 #ifdef FEAT_FOLDING | 2114 #ifdef FEAT_FOLDING |
2121 wp->w_lines[idx].wl_folded = FALSE; | 2115 wp->w_lines[idx].wl_folded = FALSE; |
2122 wp->w_lines[idx].wl_lastlnum = lnum; | 2116 wp->w_lines[idx].wl_lastlnum = lnum; |
2123 #endif | 2117 #endif |
2272 | 2266 |
2273 /* make sure the rest of the screen is blank */ | 2267 /* make sure the rest of the screen is blank */ |
2274 /* put '~'s on rows that aren't part of the file. */ | 2268 /* put '~'s on rows that aren't part of the file. */ |
2275 win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_EOB); | 2269 win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_EOB); |
2276 } | 2270 } |
2271 | |
2272 #ifdef SYN_TIME_LIMIT | |
2273 syn_set_timeout(NULL); | |
2274 #endif | |
2277 | 2275 |
2278 /* Reset the type of redrawing required, the window has been updated. */ | 2276 /* Reset the type of redrawing required, the window has been updated. */ |
2279 wp->w_redr_type = 0; | 2277 wp->w_redr_type = 0; |
2280 #ifdef FEAT_DIFF | 2278 #ifdef FEAT_DIFF |
2281 wp->w_old_topfill = wp->w_topfill; | 2279 wp->w_old_topfill = wp->w_topfill; |
2998 win_line( | 2996 win_line( |
2999 win_T *wp, | 2997 win_T *wp, |
3000 linenr_T lnum, | 2998 linenr_T lnum, |
3001 int startrow, | 2999 int startrow, |
3002 int endrow, | 3000 int endrow, |
3003 int nochange UNUSED, /* not updating for changed text */ | 3001 int nochange UNUSED) /* not updating for changed text */ |
3004 proftime_T *syntax_tm UNUSED) | |
3005 { | 3002 { |
3006 int col = 0; /* visual column on screen */ | 3003 int col = 0; /* visual column on screen */ |
3007 unsigned off; /* offset in ScreenLines/ScreenAttrs */ | 3004 unsigned off; /* offset in ScreenLines/ScreenAttrs */ |
3008 int c = 0; /* init for GCC */ | 3005 int c = 0; /* init for GCC */ |
3009 long vcol = 0; /* virtual column (for tabs) */ | 3006 long vcol = 0; /* virtual column (for tabs) */ |
3214 { | 3211 { |
3215 /* Prepare for syntax highlighting in this line. When there is an | 3212 /* Prepare for syntax highlighting in this line. When there is an |
3216 * error, stop syntax highlighting. */ | 3213 * error, stop syntax highlighting. */ |
3217 save_did_emsg = did_emsg; | 3214 save_did_emsg = did_emsg; |
3218 did_emsg = FALSE; | 3215 did_emsg = FALSE; |
3219 syntax_start(wp, lnum, syntax_tm); | 3216 syntax_start(wp, lnum); |
3220 if (did_emsg) | 3217 if (did_emsg) |
3221 wp->w_s->b_syn_error = TRUE; | 3218 wp->w_s->b_syn_error = TRUE; |
3222 else | 3219 else |
3223 { | 3220 { |
3224 did_emsg = save_did_emsg; | 3221 did_emsg = save_did_emsg; |
3612 wp->w_cursor = pos; | 3609 wp->w_cursor = pos; |
3613 | 3610 |
3614 # ifdef FEAT_SYN_HL | 3611 # ifdef FEAT_SYN_HL |
3615 /* Need to restart syntax highlighting for this line. */ | 3612 /* Need to restart syntax highlighting for this line. */ |
3616 if (has_syntax) | 3613 if (has_syntax) |
3617 syntax_start(wp, lnum, syntax_tm); | 3614 syntax_start(wp, lnum); |
3618 # endif | 3615 # endif |
3619 } | 3616 } |
3620 #endif | 3617 #endif |
3621 } | 3618 } |
3622 | 3619 |