From 450809af98c857e5161aa28f31871e52a22dacad Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 20 Aug 2012 00:19:05 +0800 Subject: [PATCH] * src/xdisp.c (handle_invisible_prop): Fix ellipses at overlay string ends. * test/redisplay-testsuite.el (test-redisplay): Use switch-to-buffer. Fixes: debbugs:3874 --- src/ChangeLog | 5 +++++ src/xdisp.c | 21 ++++++++++----------- test/ChangeLog | 4 ++++ test/redisplay-testsuite.el | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index a287474ec06..63b968c8bb5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-08-19 Chong Yidong + + * xdisp.c (handle_invisible_prop): Fix ellipses at overlay string + ends (Bug#3874). + 2012-08-19 Andreas Schwab * .gdbinit: Use call instead of set when calling a function in the diff --git a/src/xdisp.c b/src/xdisp.c index ff74af98304..aab643f9fe8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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 diff --git a/test/ChangeLog b/test/ChangeLog index cd7e9fd7ccc..c3183406ea2 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-08-19 Chong Yidong + + * redisplay-testsuite.el (test-redisplay): Use switch-to-buffer. + 2012-08-18 Chong Yidong * redisplay-testsuite.el (test-redisplay-4): New test (Bug#3874). diff --git a/test/redisplay-testsuite.el b/test/redisplay-testsuite.el index 99924daa3d9..39f81a13c60 100644 --- a/test/redisplay-testsuite.el +++ b/test/redisplay-testsuite.el @@ -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 -- 2.39.5