]> code.delx.au - gnu-emacs/commitdiff
* src/xdisp.c (handle_invisible_prop): Fix ellipses at overlay string ends.
authorChong Yidong <cyd@gnu.org>
Sun, 19 Aug 2012 16:19:05 +0000 (00:19 +0800)
committerChong Yidong <cyd@gnu.org>
Sun, 19 Aug 2012 16:19:05 +0000 (00:19 +0800)
* test/redisplay-testsuite.el (test-redisplay): Use switch-to-buffer.

Fixes: debbugs:3874
src/ChangeLog
src/xdisp.c
test/ChangeLog
test/redisplay-testsuite.el

index a287474ec06d1caf4b2ede9690aab66f5abc7fee..63b968c8bb5614cc202c4ca6baeb6f4b225a9c64 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-19  Chong Yidong  <cyd@gnu.org>
+
+       * xdisp.c (handle_invisible_prop): Fix ellipses at overlay string
+       ends (Bug#3874).
+
 2012-08-19  Andreas Schwab  <schwab@linux-m68k.org>
 
        * .gdbinit: Use call instead of set when calling a function in the
index ff74af983047b05fb87252f0fcff18aeac80073b..aab643f9fe8e2e857c2db5a486322c0782b1b372 100644 (file)
@@ -4088,35 +4088,33 @@ handle_invisible_prop (struct it *it)
          /* Record whether we have to display an ellipsis for the
             invisible text.  */
          int display_ellipsis_p = (invis_p == 2);
-         ptrdiff_t endpos;
+         ptrdiff_t len, endpos;
 
          handled = HANDLED_RECOMPUTE_PROPS;
 
          /* Get the position at which the next visible text can be
             found in IT->string, if any.  */
-         XSETINT (limit, SCHARS (it->string));
+         len = SCHARS (it->string);
+         XSETINT (limit, len);
          do
            {
              end_charpos = Fnext_single_property_change (charpos, Qinvisible,
                                                          it->string, limit);
-             if (!NILP (end_charpos))
+             if (INTEGERP (end_charpos))
                {
+                 endpos = XFASTINT (end_charpos);
                  prop = Fget_text_property (end_charpos, Qinvisible, it->string);
                  invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
                  if (invis_p == 2)
                    display_ellipsis_p = 1;
                }
            }
-         while (!NILP (end_charpos) && invis_p);
+         while (invis_p && INTEGERP (end_charpos) && endpos < len);
 
          if (display_ellipsis_p)
-           {
-             it->ellipsis_p = 1;
-             handled = HANDLED_RETURN;
-           }
+           it->ellipsis_p = 1;
 
-         if (INTEGERP (end_charpos)
-             && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit))
+         if (INTEGERP (end_charpos) && endpos < len)
            {
              /* Text at END_CHARPOS is visible.  Move IT there.  */
              struct text_pos old;
@@ -4154,7 +4152,8 @@ handle_invisible_prop (struct it *it)
              /* The rest of the string is invisible.  If this is an
                 overlay string, proceed with the next overlay string
                 or whatever comes and return a character from there.  */
-             if (it->current.overlay_string_index >= 0)
+             if (it->current.overlay_string_index >= 0
+                 && !display_ellipsis_p)
                {
                  next_overlay_string (it);
                  /* Don't check for overlay strings when we just
index cd7e9fd7cccb3eada7f79acfba57d029ca87a693..c3183406ea288cd27034baaddcf5dfbb7a04e04e 100644 (file)
@@ -1,3 +1,7 @@
+2012-08-19  Chong Yidong  <cyd@gnu.org>
+
+       * redisplay-testsuite.el (test-redisplay): Use switch-to-buffer.
+
 2012-08-18  Chong Yidong  <cyd@gnu.org>
 
        * redisplay-testsuite.el (test-redisplay-4): New test (Bug#3874).
index 99924daa3d99a53a5fa2472b1c9600cd5b0562f4..39f81a13c60bb075abde675890d7cffee479921e 100644 (file)
@@ -260,7 +260,7 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff
   (let ((buf (get-buffer "*Redisplay Test*")))
     (if buf
        (kill-buffer buf))
-    (pop-to-buffer (get-buffer-create "*Redisplay Test*"))
+    (switch-to-buffer (get-buffer-create "*Redisplay Test*"))
     (erase-buffer)
     (setq buffer-invisibility-spec
          '(test-redisplay--simple-invis