if (STRINGP (it->string))
{
- Lisp_Object end_charpos, limit, charpos;
+ Lisp_Object end_charpos, limit;
/* Get the value of the invisible text property at the
current position. Value will be nil if there is no such
property. */
- charpos = make_number (IT_STRING_CHARPOS (*it));
- prop = Fget_text_property (charpos, Qinvisible, it->string);
+ end_charpos = make_number (IT_STRING_CHARPOS (*it));
+ prop = Fget_text_property (end_charpos, Qinvisible, it->string);
invis = TEXT_PROP_MEANS_INVISIBLE (prop);
if (invis != 0 && IT_STRING_CHARPOS (*it) < it->end_charpos)
XSETINT (limit, len);
do
{
- end_charpos = Fnext_single_property_change (charpos, Qinvisible,
- it->string, limit);
+ end_charpos
+ = Fnext_single_property_change (end_charpos, Qinvisible,
+ it->string, limit);
+ /* Since LIMIT is always an integer, so should be the
+ value returned by Fnext_single_property_change. */
+ eassert (INTEGERP (end_charpos));
if (INTEGERP (end_charpos))
{
endpos = XFASTINT (end_charpos);
if (invis == 2)
display_ellipsis_p = true;
}
+ else /* Should never happen; but if it does, exit the loop. */
+ endpos = len;
}
while (invis != 0 && endpos < len);
}
else
{
- IT_STRING_CHARPOS (*it) = XFASTINT (end_charpos);
+ IT_STRING_CHARPOS (*it) = endpos;
compute_string_pos (&it->current.string_pos, old, it->string);
}
}
(str "ABC"))
(put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis str)
(overlay-put ov 'display str)))
+ ;; Overlay string with 2 adjacent and different invisible
+ ;; properties. This caused an infloop before Emacs 25.
+ (insert "\n Expected: ABC")
+ (insert "\n Result: ")
+ (let ((opoint (point)))
+ (insert "ABC\n")
+ (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))
+ (str (concat (propertize "X"
+ 'invisible 'test-redisplay--simple-invis)
+ (propertize "Y"
+ 'invisible 'test-redisplay--simple-invis2))))
+ (overlay-put ov 'after-string str)))
(insert "\n"))
(erase-buffer)
(setq buffer-invisibility-spec
'(test-redisplay--simple-invis
+ test-redisplay--simple-invis2
(test-redisplay--ellipsis-invis . t)))
(test-redisplay-1)
(test-redisplay-2)