summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-06-25 10:46:10 +0300
committerEli Zaretskii <eliz@gnu.org>2022-06-25 10:46:10 +0300
commit473affe5c6f44973725dd5bfb6990e089657e81e (patch)
tree138daffdef332ce1c1b8e70a8d1fd9561b7f3aef /src
parent230891d9f33644146cf1e962824618256374eadc (diff)
downloademacs-473affe5c6f44973725dd5bfb6990e089657e81e.tar.gz
emacs-473affe5c6f44973725dd5bfb6990e089657e81e.tar.bz2
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,
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);
}
}
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,
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. */
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; \
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);
}
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,
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;