[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 89740e9: Prevent redisplay from moving point behind user's back
From: |
Eli Zaretskii |
Subject: |
emacs-27 89740e9: Prevent redisplay from moving point behind user's back |
Date: |
Wed, 4 Nov 2020 15:11:42 -0500 (EST) |
branch: emacs-27
commit 89740e9cb59ec05f3eef5a53dc39845d7d9fb638
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Prevent redisplay from moving point behind user's back
* src/bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start):
Bind inhibit-quit to a non-nil value around calls to
fast_looking_at, to prevent breaking out of redisplay_window,
which temporarily moves point in buffers shown in non-selected
windows. (Bug#44448)
---
src/bidi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/bidi.c b/src/bidi.c
index 3abde7f..77e92c3 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1458,6 +1458,11 @@ bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t
bytepos)
else
start_re = paragraph_start_re;
+ /* Prevent quitting inside re_match_2, as redisplay_window could
+ have temporarily moved point. */
+ ptrdiff_t count = SPECPDL_INDEX ();
+ specbind (Qinhibit_quit, Qt);
+
val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil);
if (val < 0)
{
@@ -1467,6 +1472,7 @@ bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t
bytepos)
val = -2;
}
+ unbind_to (count, Qnil);
return val;
}
@@ -1542,6 +1548,11 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t
pos_byte)
if (cache_buffer->base_buffer)
cache_buffer = cache_buffer->base_buffer;
+ /* Prevent quitting inside re_match_2, as redisplay_window could
+ have temporarily moved point. */
+ ptrdiff_t count = SPECPDL_INDEX ();
+ specbind (Qinhibit_quit, Qt);
+
while (pos_byte > BEGV_BYTE
&& n++ < MAX_PARAGRAPH_SEARCH
&& fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0)
@@ -1559,6 +1570,7 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t
pos_byte)
else
pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte);
}
+ unbind_to (count, Qnil);
if (n >= MAX_PARAGRAPH_SEARCH)
pos = BEGV, pos_byte = BEGV_BYTE;
if (bpc)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-27 89740e9: Prevent redisplay from moving point behind user's back,
Eli Zaretskii <=