emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r116963: Fix bidirectional redisplay when deletio


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r116963: Fix bidirectional redisplay when deletion creates a paragraph start.
Date: Mon, 14 Apr 2014 15:33:18 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116963
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Mon 2014-04-14 18:32:27 +0300
message:
  Fix bidirectional redisplay when deletion creates a paragraph start.
  
   src/insdel.c (invalidate_buffer_caches): When deleting or replacing
   text, invalidate the bidi_paragraph_cache upto and including the
   preceding newline.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/insdel.c                   insdel.c-20091113204419-o5vbwnq5f7feedwu-175
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-04-13 22:51:08 +0000
+++ b/src/ChangeLog     2014-04-14 15:32:27 +0000
@@ -1,3 +1,9 @@
+2014-04-14  Eli Zaretskii  <address@hidden>
+
+       * insdel.c (invalidate_buffer_caches): When deleting or replacing
+       text, invalidate the bidi_paragraph_cache upto and including the
+       preceding newline.
+
 2014-04-13  Paul Eggert  <address@hidden>
 
        Port to IRIX 6.5 (Bug#9684).

=== modified file 'src/insdel.c'
--- a/src/insdel.c      2014-03-26 04:07:25 +0000
+++ b/src/insdel.c      2014-04-14 15:32:27 +0000
@@ -1866,9 +1866,35 @@
                              buf->width_run_cache,
                              start - BUF_BEG (buf), BUF_Z (buf) - end);
   if (buf->bidi_paragraph_cache)
-    invalidate_region_cache (buf,
-                             buf->bidi_paragraph_cache,
-                             start - BUF_BEG (buf), BUF_Z (buf) - end);
+    {
+      if (start != end
+         && 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.  */
+         ptrdiff_t line_beg = start;
+         ptrdiff_t start_byte = buf_charpos_to_bytepos (buf, start);
+
+         if (BUF_FETCH_BYTE (buf, start_byte - 1) != '\n')
+           {
+             struct buffer *old = current_buffer;
+
+             set_buffer_internal (buf);
+
+             line_beg = find_newline_no_quit (start, start_byte, -1,
+                                              &start_byte);
+             set_buffer_internal (old);
+           }
+         if (line_beg > BUF_BEG (buf))
+           start = line_beg - 1;
+       }
+      invalidate_region_cache (buf,
+                              buf->bidi_paragraph_cache,
+                              start - BUF_BEG (buf), BUF_Z (buf) - end);
+    }
 }
 
 /* These macros work with an argument named `preserve_ptr'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]