diff options
| author | Eli Zaretskii | 2020-11-04 22:10:06 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2020-11-04 22:10:06 +0200 |
| commit | 89740e9cb59ec05f3eef5a53dc39845d7d9fb638 (patch) | |
| tree | a3da4a2f9cf17fcde93f3c283c1ad2271d65f5bb /src | |
| parent | 5932df74354316e117b2e6a43dc3ffd748aa7c7f (diff) | |
| download | emacs-89740e9cb59ec05f3eef5a53dc39845d7d9fb638.tar.gz emacs-89740e9cb59ec05f3eef5a53dc39845d7d9fb638.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/bidi.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bidi.c b/src/bidi.c index 3abde7fcb09..77e92c302f3 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -1458,6 +1458,11 @@ bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t bytepos) | |||
| 1458 | else | 1458 | else |
| 1459 | start_re = paragraph_start_re; | 1459 | start_re = paragraph_start_re; |
| 1460 | 1460 | ||
| 1461 | /* Prevent quitting inside re_match_2, as redisplay_window could | ||
| 1462 | have temporarily moved point. */ | ||
| 1463 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 1464 | specbind (Qinhibit_quit, Qt); | ||
| 1465 | |||
| 1461 | val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil); | 1466 | val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil); |
| 1462 | if (val < 0) | 1467 | if (val < 0) |
| 1463 | { | 1468 | { |
| @@ -1467,6 +1472,7 @@ bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t bytepos) | |||
| 1467 | val = -2; | 1472 | val = -2; |
| 1468 | } | 1473 | } |
| 1469 | 1474 | ||
| 1475 | unbind_to (count, Qnil); | ||
| 1470 | return val; | 1476 | return val; |
| 1471 | } | 1477 | } |
| 1472 | 1478 | ||
| @@ -1542,6 +1548,11 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 1542 | if (cache_buffer->base_buffer) | 1548 | if (cache_buffer->base_buffer) |
| 1543 | cache_buffer = cache_buffer->base_buffer; | 1549 | cache_buffer = cache_buffer->base_buffer; |
| 1544 | 1550 | ||
| 1551 | /* Prevent quitting inside re_match_2, as redisplay_window could | ||
| 1552 | have temporarily moved point. */ | ||
| 1553 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 1554 | specbind (Qinhibit_quit, Qt); | ||
| 1555 | |||
| 1545 | while (pos_byte > BEGV_BYTE | 1556 | while (pos_byte > BEGV_BYTE |
| 1546 | && n++ < MAX_PARAGRAPH_SEARCH | 1557 | && n++ < MAX_PARAGRAPH_SEARCH |
| 1547 | && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) | 1558 | && 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) | |||
| 1559 | else | 1570 | else |
| 1560 | pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte); | 1571 | pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte); |
| 1561 | } | 1572 | } |
| 1573 | unbind_to (count, Qnil); | ||
| 1562 | if (n >= MAX_PARAGRAPH_SEARCH) | 1574 | if (n >= MAX_PARAGRAPH_SEARCH) |
| 1563 | pos = BEGV, pos_byte = BEGV_BYTE; | 1575 | pos = BEGV, pos_byte = BEGV_BYTE; |
| 1564 | if (bpc) | 1576 | if (bpc) |