[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 94672c2936 07/14: Handle too long syntactic fontifications
From: |
Eli Zaretskii |
Subject: |
master 94672c2936 07/14: Handle too long syntactic fontifications |
Date: |
Fri, 24 Jun 2022 03:54:18 -0400 (EDT) |
branch: master
commit 94672c2936dd58a1837fd208f8678074ca8193c3
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Handle too long syntactic fontifications
* src/syntax.c (scan_sexps_forward): Call 'update_redisplay_ticks'
after finishing the loop.
* src/dispnew.c (make_current): Make sure enabled rows of the
current matrix have a valid hash, even if redisplay of a window
was aborted due to slowness. This avoids assertion violations in
'scrolling_window' due to the wrong hash value.
---
src/dispnew.c | 8 ++++++++
src/syntax.c | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/src/dispnew.c b/src/dispnew.c
index 7a4d9f8710..9d587ea00e 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -2738,6 +2738,14 @@ make_current (struct glyph_matrix *desired_matrix,
struct glyph_matrix *current_
struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, row);
bool mouse_face_p = current_row->mouse_face_p;
+ /* If we aborted redisplay of this window, a row in the desired
+ matrix might not have its hash computed. */
+ if (!(!desired_row->used[0]
+ && !desired_row->used[1]
+ && !desired_row->used[2])
+ && !desired_row->hash)
+ desired_row->hash = row_hash (desired_row);
+
/* Do current_row = desired_row. This exchanges glyph pointers
between both rows, and does a structure assignment otherwise. */
assign_row (current_row, desired_row);
diff --git a/src/syntax.c b/src/syntax.c
index f9022d18d2..de9193e2de 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
#include <config.h>
#include "lisp.h"
+#include "dispextern.h"
#include "character.h"
#include "buffer.h"
#include "regex-emacs.h"
@@ -3195,6 +3196,7 @@ scan_sexps_forward (struct lisp_parse_state *state,
ptrdiff_t out_bytepos, out_charpos;
int temp;
unsigned short int quit_count = 0;
+ ptrdiff_t started_from = from;
prev_from = from;
prev_from_byte = from_byte;
@@ -3474,6 +3476,12 @@ do { prev_from = from; \
state->levelstarts);
state->prev_syntax = (SYNTAX_FLAGS_COMSTARTEND_FIRST (prev_from_syntax)
|| state->quoted) ? prev_from_syntax : Smax;
+
+ /* The factor of 10 below is a heuristic that needs to be tuned. It
+ means we consider 10 buffer positions examined by this function
+ roughly equivalent to the display engine iterating over a single
+ buffer position. */
+ update_redisplay_ticks ((from - started_from) / 10 + 1, NULL);
}
/* Convert a (lisp) parse state to the internal form used in
- Re: master e1e0315252 01/14: Initial implementation of "abort-redisplay" feature, (continued)
- master f1e1392868 03/14: Change the API of 'update_redisplay_ticks', Eli Zaretskii, 2022/06/24
- master 82626e62ab 08/14: Allow aborting redisplay stuck in 'parse-partial-sexp', Eli Zaretskii, 2022/06/24
- master a82af5ae78 09/14: Don't count ticks too eagerly in syntax.c, Eli Zaretskii, 2022/06/24
- master 5a596bbed5 02/14: Fix a typo in a doc string., Eli Zaretskii, 2022/06/24
- master bd44f39d6d 04/14: Restart tick counting every command, Eli Zaretskii, 2022/06/24
- master 264472a507 05/14: Handle W = NULL in 'update_redisplay_ticks', Eli Zaretskii, 2022/06/24
- master b89b23079c 12/14: Show warnings about aborted redisplay, Eli Zaretskii, 2022/06/24
- master 287e714fe0 11/14: Update redisplay ticks for more operations, and misc modifications, Eli Zaretskii, 2022/06/24
- master 94e1185369 06/14: Support callers which sometimes run unrelated to display code, Eli Zaretskii, 2022/06/24
- master 94672c2936 07/14: Handle too long syntactic fontifications,
Eli Zaretskii <=
- master 4b00bc47c7 10/14: Update documentation, Eli Zaretskii, 2022/06/24
- master 289b457cac 14/14: Merge branch 'abort-redisplay', Eli Zaretskii, 2022/06/24
- master 6fcd8ca743 13/14: ; * etc/NEWS: Minor update of description of 'max-redisplay-ticks'., Eli Zaretskii, 2022/06/24