[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 473affe5c6: Minor optimization of the "abort redisplay" feature
From: |
Eli Zaretskii |
Subject: |
master 473affe5c6: Minor optimization of the "abort redisplay" feature |
Date: |
Sat, 25 Jun 2022 03:47:09 -0400 (EDT) |
branch: master
commit 473affe5c6f44973725dd5bfb6990e089657e81e
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
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)
---
src/bidi.c | 10 +++++-----
src/regex-emacs.c | 4 ++--
src/syntax.c | 2 +-
src/xdisp.c | 9 ++++++---
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/bidi.c b/src/bidi.c
index 267b62fb0b..c4d04136e9 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 4d87418eea..9b2c14c413 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 c13a8179ee..15625b4d0e 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 886c3f4ecb..cbe6feeae4 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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 473affe5c6: Minor optimization of the "abort redisplay" feature,
Eli Zaretskii <=