[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f591765: Fix bidi paragraph direction when insertin
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master f591765: Fix bidi paragraph direction when inserting text at newline |
Date: |
Mon, 13 Mar 2017 12:16:52 -0400 (EDT) |
branch: master
commit f591765e2b6b9ec3fa3ff647c77a10c984f78133
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Fix bidi paragraph direction when inserting text at newline
* src/insdel.c (invalidate_buffer_caches): Invalidate the bidi
paragraph cache when inserting immediately after a newline.
(Bug#26083)
---
src/insdel.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/insdel.c b/src/insdel.c
index e4ad9a2..0a2e07a 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2001,18 +2001,21 @@ invalidate_buffer_caches (struct buffer *buf, ptrdiff_t
start, ptrdiff_t end)
see below). */
if (buf->bidi_paragraph_cache)
{
- if (start != end
- && start > BUF_BEG (buf))
+ if (start > BUF_BEG (buf))
{
/* If we are deleting or replacing characters, we could
create a paragraph start, because all of the characters
from START to the beginning of START's line are
whitespace. Therefore, we must extend the region to be
- invalidated up to the newline before START. */
+ invalidated up to the newline before START. Similarly,
+ if we are inserting characters immediately after a
+ newline, we could create a paragraph start if the
+ inserted characters start with a newline. */
ptrdiff_t line_beg = start;
ptrdiff_t start_byte = buf_charpos_to_bytepos (buf, start);
+ int prev_char = BUF_FETCH_BYTE (buf, start_byte - 1);
- if (BUF_FETCH_BYTE (buf, start_byte - 1) != '\n')
+ if ((start == end) == (prev_char == '\n'))
{
struct buffer *old = current_buffer;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master f591765: Fix bidi paragraph direction when inserting text at newline,
Eli Zaretskii <=