aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-08-08 16:55:26 +0300
committerEli Zaretskii2015-08-08 16:55:26 +0300
commit1bb08a8cb10f0b8aa862d93a57edf70591fd135e (patch)
tree35bf796ed208205d57033f08c929a5c9bcf4321d
parent7afa4f300b9dc38bf3f33b18fa83bfe35e21a479 (diff)
downloademacs-1bb08a8cb10f0b8aa862d93a57edf70591fd135e.tar.gz
emacs-1bb08a8cb10f0b8aa862d93a57edf70591fd135e.zip
Fix overlay string display regressions introduced in Emacs 24.5
* src/xdisp.c (pop_it): Reset the flag to ignore overlays at this buffer position, if we move the iterator to a new position as result of jumping over text covered by a "replacing" display property. * test/redisplay-testsuite.el (test-redisplay-4): Add 2 new tests.
-rw-r--r--src/xdisp.c6
-rw-r--r--test/redisplay-testsuite.el35
2 files changed, 41 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index e7626d1ce25..711fe080b03 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5972,6 +5972,7 @@ pop_it (struct it *it)
5972{ 5972{
5973 struct iterator_stack_entry *p; 5973 struct iterator_stack_entry *p;
5974 bool from_display_prop = it->from_disp_prop_p; 5974 bool from_display_prop = it->from_disp_prop_p;
5975 ptrdiff_t prev_pos = IT_CHARPOS (*it);
5975 5976
5976 eassert (it->sp > 0); 5977 eassert (it->sp > 0);
5977 --it->sp; 5978 --it->sp;
@@ -6060,6 +6061,11 @@ pop_it (struct it *it)
6060 && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos) 6061 && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos)
6061 || (CONSP (it->object) && it->method == GET_FROM_STRETCH)); 6062 || (CONSP (it->object) && it->method == GET_FROM_STRETCH));
6062 } 6063 }
6064 /* If we move the iterator over text covered by a display property
6065 to a new buffer position, any info about previously seen overlays
6066 is no longer valid. */
6067 if (from_display_prop && it->sp == 0 && CHARPOS (it->position) != prev_pos)
6068 it->ignore_overlay_strings_at_pos_p = false;
6063} 6069}
6064 6070
6065 6071
diff --git a/test/redisplay-testsuite.el b/test/redisplay-testsuite.el
index 40a21b7fea4..a5ec1e89eaf 100644
--- a/test/redisplay-testsuite.el
+++ b/test/redisplay-testsuite.el
@@ -251,6 +251,41 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff
251 (str "ABC")) 251 (str "ABC"))
252 (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis str) 252 (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis str)
253 (overlay-put ov 'display str))) 253 (overlay-put ov 'display str)))
254 ;; Overlay string over invisible text and non-default face.
255 (insert "\n Expected: ..." (propertize "ABC" 'face 'highlight) "XYZ")
256 (insert "\n Result: ")
257 (insert (propertize "foo" 'invisible 'test-redisplay--ellipsis-invis))
258 (let ((ov (make-overlay (point) (point))))
259 (overlay-put ov 'invisible t)
260 (overlay-put ov 'window (selected-window))
261 (overlay-put ov 'after-string
262 (propertize "ABC" 'face 'highlight)))
263 (insert "XYZ\n")
264 ;; Overlay strings with partial `invisibility' property and with a
265 ;; display property on the before-string.
266 (insert "\n Expected: A...C")
267 (insert "\n Result: ")
268 (let ((opoint (point)))
269 (insert "X\n")
270 (let ((ov (make-overlay opoint (1+ opoint)))
271 (str "ABC"))
272 (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis str)
273 (overlay-put ov 'display str)))
274 (insert "\n Expected: ..."
275 (propertize "DEF" 'display '(image :type xpm :file "close.xpm"))
276 (propertize "ABC" 'face 'highlight) "XYZ")
277 (insert "\n Result: ")
278 (insert (propertize "foo" 'invisible 'test-redisplay--ellipsis-invis))
279 (let ((ov (make-overlay (point) (point))))
280 (overlay-put ov 'invisible t)
281 (overlay-put ov 'window (selected-window))
282 (overlay-put ov 'after-string
283 (propertize "ABC" 'face 'highlight))
284 (overlay-put ov 'before-string
285 (propertize "DEF"
286 'display '(image :type xpm :file "close.xpm"))))
287 (insert "XYZ\n")
288
254 ;; Overlay string with 2 adjacent and different invisible 289 ;; Overlay string with 2 adjacent and different invisible
255 ;; properties. This caused an infloop before Emacs 25. 290 ;; properties. This caused an infloop before Emacs 25.
256 (insert "\n Expected: ABC") 291 (insert "\n Expected: ABC")