emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105320: Fix logic of caching display


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105320: Fix logic of caching display string positions for bidi display.
Date: Mon, 25 Jul 2011 18:36:47 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105320 [merge]
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2011-07-25 18:36:47 +0300
message:
  Fix logic of caching display string positions for bidi display.
  
   src/xdisp.c (compute_display_string_pos): Fix logic of caching
   previous display string position.  Initialize cached_prev_pos to -1.
   Fixes slow-down at the beginning of a buffer.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-07-24 05:30:09 +0000
+++ b/src/ChangeLog     2011-07-25 15:36:47 +0000
@@ -1,3 +1,9 @@
+2011-07-25  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (compute_display_string_pos): Fix logic of caching
+       previous display string position.  Initialize cached_prev_pos to
+       -1.  Fixes slow-down at the beginning of a buffer.
+
 2011-07-24  Eli Zaretskii  <address@hidden>
 
        * xfaces.c (check_lface_attrs) [HAVE_WINDOW_SYSTEM]: Allow `nil'

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-07-23 10:58:44 +0000
+++ b/src/xdisp.c       2011-07-25 15:36:47 +0000
@@ -3137,7 +3137,7 @@
 /* Record one cached display string position found recently by
    compute_display_string_pos.  */
 static EMACS_INT cached_disp_pos;
-static EMACS_INT cached_prev_pos;
+static EMACS_INT cached_prev_pos = -1;
 static struct buffer *cached_disp_buffer;
 static int cached_disp_modiff;
 static int cached_disp_overlay_modiff;
@@ -3184,18 +3184,22 @@
          && BUF_MODIFF (b) == cached_disp_modiff
          && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff)
        {
-         if (cached_prev_pos
+         if (cached_prev_pos >= 0
              && cached_prev_pos < charpos && charpos <= cached_disp_pos)
            return cached_disp_pos;
          /* Handle overstepping either end of the known interval.  */
          if (charpos > cached_disp_pos)
            cached_prev_pos = cached_disp_pos;
          else  /* charpos <= cached_prev_pos */
-           cached_prev_pos = max (charpos - 1, BEGV);
+           cached_prev_pos = max (charpos - 1, 0);
        }
 
       /* Record new values in the cache.  */
-      cached_disp_buffer = b;
+      if (b != cached_disp_buffer)
+       {
+         cached_disp_buffer = b;
+         cached_prev_pos = max (charpos - 1, 0);
+       }
       cached_disp_modiff = BUF_MODIFF (b);
       cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b);
     }


reply via email to

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