aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2022-06-25 10:46:10 +0300
committerEli Zaretskii2022-06-25 10:46:10 +0300
commit473affe5c6f44973725dd5bfb6990e089657e81e (patch)
tree138daffdef332ce1c1b8e70a8d1fd9561b7f3aef /src
parent230891d9f33644146cf1e962824618256374eadc (diff)
downloademacs-473affe5c6f44973725dd5bfb6990e089657e81e.tar.gz
emacs-473affe5c6f44973725dd5bfb6990e089657e81e.zip
Minor optimization of the "abort redisplay" feature
* src/xdisp.c (init_iterator, set_iterator_to_next) (redisplay_internal): * src/syntax.c (scan_sexps_forward): * src/regex-emacs.c (re_match_2_internal): * src/bidi.c (bidi_fetch_char, bidi_paragraph_init) (bidi_find_bracket_pairs, bidi_find_other_level_edge): Don't call 'update_redisplay_ticks' if aborting too-long redisplay is disabled. (Bug#45898)
Diffstat (limited to 'src')
-rw-r--r--src/bidi.c10
-rw-r--r--src/regex-emacs.c4
-rw-r--r--src/syntax.c2
-rw-r--r--src/xdisp.c9
4 files changed, 14 insertions, 11 deletions
diff --git a/src/bidi.c b/src/bidi.c
index 267b62fb0bc..c4d04136e9e 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1281,7 +1281,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
1281 tuned. It means we consider 100 buffer positions examined by 1281 tuned. It means we consider 100 buffer positions examined by
1282 the above call roughly equivalent to the display engine 1282 the above call roughly equivalent to the display engine
1283 iterating over a single buffer position. */ 1283 iterating over a single buffer position. */
1284 if (*disp_pos > charpos) 1284 if (max_redisplay_ticks > 0 && *disp_pos > charpos)
1285 update_redisplay_ticks ((*disp_pos - charpos) / 100 + 1, w); 1285 update_redisplay_ticks ((*disp_pos - charpos) / 100 + 1, w);
1286 } 1286 }
1287 1287
@@ -1391,7 +1391,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
1391 SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len); 1391 SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len);
1392 *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p, 1392 *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p,
1393 disp_prop); 1393 disp_prop);
1394 if (*disp_pos > charpos + *nchars) 1394 if (max_redisplay_ticks > 0 && *disp_pos > charpos + *nchars)
1395 update_redisplay_ticks ((*disp_pos - charpos - *nchars) / 100 + 1, w); 1395 update_redisplay_ticks ((*disp_pos - charpos - *nchars) / 100 + 1, w);
1396 } 1396 }
1397 1397
@@ -1822,7 +1822,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
1822 roughly equivalent to the display engine iterating over a single 1822 roughly equivalent to the display engine iterating over a single
1823 buffer position. */ 1823 buffer position. */
1824 ptrdiff_t nexamined = bidi_it->charpos - pos + nsearch_for_strong; 1824 ptrdiff_t nexamined = bidi_it->charpos - pos + nsearch_for_strong;
1825 if (nexamined > 0) 1825 if (max_redisplay_ticks > 0 && nexamined > 0)
1826 update_redisplay_ticks (nexamined / 50, bidi_it->w); 1826 update_redisplay_ticks (nexamined / 50, bidi_it->w);
1827} 1827}
1828 1828
@@ -2825,7 +2825,7 @@ bidi_find_bracket_pairs (struct bidi_it *bidi_it)
2825 means we consider 20 buffer positions examined by this function 2825 means we consider 20 buffer positions examined by this function
2826 roughly equivalent to the display engine iterating over a single 2826 roughly equivalent to the display engine iterating over a single
2827 buffer position. */ 2827 buffer position. */
2828 if (n > 0) 2828 if (max_redisplay_ticks > 0 && n > 0)
2829 update_redisplay_ticks (n / 20 + 1, bidi_it->w); 2829 update_redisplay_ticks (n / 20 + 1, bidi_it->w);
2830 return retval; 2830 return retval;
2831} 2831}
@@ -3436,7 +3436,7 @@ bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, bool end_flag)
3436 tuned. It means we consider 50 buffer positions examined by 3436 tuned. It means we consider 50 buffer positions examined by
3437 the above call roughly equivalent to the display engine 3437 the above call roughly equivalent to the display engine
3438 iterating over a single buffer position. */ 3438 iterating over a single buffer position. */
3439 if (bidi_it->charpos > pos0) 3439 if (max_redisplay_ticks > 0 && bidi_it->charpos > pos0)
3440 update_redisplay_ticks ((bidi_it->charpos - pos0) / 50 + 1, bidi_it->w); 3440 update_redisplay_ticks ((bidi_it->charpos - pos0) / 50 + 1, bidi_it->w);
3441 } 3441 }
3442} 3442}
diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 4d87418eeaf..9b2c14c413d 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -4217,7 +4217,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
4217 means we consider 50 buffer positions examined by this function 4217 means we consider 50 buffer positions examined by this function
4218 roughly equivalent to the display engine iterating over a single 4218 roughly equivalent to the display engine iterating over a single
4219 buffer position. */ 4219 buffer position. */
4220 if (nchars > 0) 4220 if (max_redisplay_ticks > 0 && nchars > 0)
4221 update_redisplay_ticks (nchars / 50 + 1, NULL); 4221 update_redisplay_ticks (nchars / 50 + 1, NULL);
4222 return dcnt; 4222 return dcnt;
4223 } 4223 }
@@ -5087,7 +5087,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
5087 unbind_to (count, Qnil); 5087 unbind_to (count, Qnil);
5088 SAFE_FREE (); 5088 SAFE_FREE ();
5089 5089
5090 if (nchars > 0) 5090 if (max_redisplay_ticks > 0 && nchars > 0)
5091 update_redisplay_ticks (nchars / 50 + 1, NULL); 5091 update_redisplay_ticks (nchars / 50 + 1, NULL);
5092 5092
5093 return -1; /* Failure to match. */ 5093 return -1; /* Failure to match. */
diff --git a/src/syntax.c b/src/syntax.c
index c13a8179ee4..15625b4d0e2 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3481,7 +3481,7 @@ do { prev_from = from; \
3481 means we consider 10 buffer positions examined by this function 3481 means we consider 10 buffer positions examined by this function
3482 roughly equivalent to the display engine iterating over a single 3482 roughly equivalent to the display engine iterating over a single
3483 buffer position. */ 3483 buffer position. */
3484 if (from > started_from) 3484 if (max_redisplay_ticks > 0 && from > started_from)
3485 update_redisplay_ticks ((from - started_from) / 10 + 1, NULL); 3485 update_redisplay_ticks ((from - started_from) / 10 + 1, NULL);
3486} 3486}
3487 3487
diff --git a/src/xdisp.c b/src/xdisp.c
index 886c3f4ecbf..cbe6feeae48 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3231,7 +3231,8 @@ init_iterator (struct it *it, struct window *w,
3231 3231
3232 it->cmp_it.id = -1; 3232 it->cmp_it.id = -1;
3233 3233
3234 update_redisplay_ticks (0, w); 3234 if (max_redisplay_ticks > 0)
3235 update_redisplay_ticks (0, w);
3235 3236
3236 /* Extra space between lines (on window systems only). */ 3237 /* Extra space between lines (on window systems only). */
3237 if (base_face_id == DEFAULT_FACE_ID 3238 if (base_face_id == DEFAULT_FACE_ID
@@ -8186,7 +8187,8 @@ void
8186set_iterator_to_next (struct it *it, bool reseat_p) 8187set_iterator_to_next (struct it *it, bool reseat_p)
8187{ 8188{
8188 8189
8189 update_redisplay_ticks (1, it->w); 8190 if (max_redisplay_ticks > 0)
8191 update_redisplay_ticks (1, it->w);
8190 8192
8191 switch (it->method) 8193 switch (it->method)
8192 { 8194 {
@@ -16925,7 +16927,8 @@ redisplay_internal (void)
16925 16927
16926 /* We're done with this redisplay cycle, so reset the tick count in 16928 /* We're done with this redisplay cycle, so reset the tick count in
16927 preparation for the next redisplay cycle. */ 16929 preparation for the next redisplay cycle. */
16928 update_redisplay_ticks (0, NULL); 16930 if (max_redisplay_ticks > 0)
16931 update_redisplay_ticks (0, NULL);
16929 16932
16930 unbind_to (count, Qnil); 16933 unbind_to (count, Qnil);
16931 RESUME_POLLING; 16934 RESUME_POLLING;