1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-01 11:14:55 +00:00

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)
This commit is contained in:
Eli Zaretskii 2022-06-25 10:46:10 +03:00
parent 230891d9f3
commit 473affe5c6
4 changed files with 14 additions and 11 deletions

View File

@ -1281,7 +1281,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
tuned. It means we consider 100 buffer positions examined by
the above call roughly equivalent to the display engine
iterating over a single buffer position. */
if (*disp_pos > charpos)
if (max_redisplay_ticks > 0 && *disp_pos > charpos)
update_redisplay_ticks ((*disp_pos - charpos) / 100 + 1, w);
}
@ -1391,7 +1391,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len);
*disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p,
disp_prop);
if (*disp_pos > charpos + *nchars)
if (max_redisplay_ticks > 0 && *disp_pos > charpos + *nchars)
update_redisplay_ticks ((*disp_pos - charpos - *nchars) / 100 + 1, w);
}
@ -1822,7 +1822,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
roughly equivalent to the display engine iterating over a single
buffer position. */
ptrdiff_t nexamined = bidi_it->charpos - pos + nsearch_for_strong;
if (nexamined > 0)
if (max_redisplay_ticks > 0 && nexamined > 0)
update_redisplay_ticks (nexamined / 50, bidi_it->w);
}
@ -2825,7 +2825,7 @@ bidi_find_bracket_pairs (struct bidi_it *bidi_it)
means we consider 20 buffer positions examined by this function
roughly equivalent to the display engine iterating over a single
buffer position. */
if (n > 0)
if (max_redisplay_ticks > 0 && n > 0)
update_redisplay_ticks (n / 20 + 1, bidi_it->w);
return retval;
}
@ -3436,7 +3436,7 @@ bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, bool end_flag)
tuned. It means we consider 50 buffer positions examined by
the above call roughly equivalent to the display engine
iterating over a single buffer position. */
if (bidi_it->charpos > pos0)
if (max_redisplay_ticks > 0 && bidi_it->charpos > pos0)
update_redisplay_ticks ((bidi_it->charpos - pos0) / 50 + 1, bidi_it->w);
}
}

View File

@ -4217,7 +4217,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
means we consider 50 buffer positions examined by this function
roughly equivalent to the display engine iterating over a single
buffer position. */
if (nchars > 0)
if (max_redisplay_ticks > 0 && nchars > 0)
update_redisplay_ticks (nchars / 50 + 1, NULL);
return dcnt;
}
@ -5087,7 +5087,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
unbind_to (count, Qnil);
SAFE_FREE ();
if (nchars > 0)
if (max_redisplay_ticks > 0 && nchars > 0)
update_redisplay_ticks (nchars / 50 + 1, NULL);
return -1; /* Failure to match. */

View File

@ -3481,7 +3481,7 @@ do { prev_from = from; \
means we consider 10 buffer positions examined by this function
roughly equivalent to the display engine iterating over a single
buffer position. */
if (from > started_from)
if (max_redisplay_ticks > 0 && from > started_from)
update_redisplay_ticks ((from - started_from) / 10 + 1, NULL);
}

View File

@ -3231,7 +3231,8 @@ init_iterator (struct it *it, struct window *w,
it->cmp_it.id = -1;
update_redisplay_ticks (0, w);
if (max_redisplay_ticks > 0)
update_redisplay_ticks (0, w);
/* Extra space between lines (on window systems only). */
if (base_face_id == DEFAULT_FACE_ID
@ -8186,7 +8187,8 @@ void
set_iterator_to_next (struct it *it, bool reseat_p)
{
update_redisplay_ticks (1, it->w);
if (max_redisplay_ticks > 0)
update_redisplay_ticks (1, it->w);
switch (it->method)
{
@ -16925,7 +16927,8 @@ redisplay_internal (void)
/* We're done with this redisplay cycle, so reset the tick count in
preparation for the next redisplay cycle. */
update_redisplay_ticks (0, NULL);
if (max_redisplay_ticks > 0)
update_redisplay_ticks (0, NULL);
unbind_to (count, Qnil);
RESUME_POLLING;