Mercurial > emacs
comparison src/xdisp.c @ 59610:14875395f75b
(back_to_previous_visible_line_start): Undo 2004-12-28
change. If handle_display_prop indicates newline is replaced by
image or text, move back to start of relevant overlay or interval
and continue scan from there. Simplify.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Tue, 18 Jan 2005 00:13:24 +0000 |
parents | 92e1b372276b |
children | 4b1b522ba215 |
comparison
equal
deleted
inserted
replaced
59609:ebe61bf4c2a3 | 59610:14875395f75b |
---|---|
4571 | 4571 |
4572 static void | 4572 static void |
4573 back_to_previous_visible_line_start (it) | 4573 back_to_previous_visible_line_start (it) |
4574 struct it *it; | 4574 struct it *it; |
4575 { | 4575 { |
4576 int visible_p = 0; | 4576 while (IT_CHARPOS (*it) > BEGV) |
4577 | 4577 { |
4578 /* Go back one newline if not on BEGV already. */ | 4578 back_to_previous_line_start (it); |
4579 if (IT_CHARPOS (*it) > BEGV) | 4579 if (IT_CHARPOS (*it) <= BEGV) |
4580 back_to_previous_line_start (it); | 4580 break; |
4581 | |
4582 /* Move over lines that are invisible because of selective display | |
4583 or text properties. */ | |
4584 while (IT_CHARPOS (*it) > BEGV | |
4585 && !visible_p) | |
4586 { | |
4587 visible_p = 1; | |
4588 | 4581 |
4589 /* If selective > 0, then lines indented more than that values | 4582 /* If selective > 0, then lines indented more than that values |
4590 are invisible. */ | 4583 are invisible. */ |
4591 if (it->selective > 0 | 4584 if (it->selective > 0 |
4592 && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it), | 4585 && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it), |
4593 (double) it->selective)) /* iftc */ | 4586 (double) it->selective)) /* iftc */ |
4594 visible_p = 0; | 4587 continue; |
4595 else | 4588 |
4596 { | 4589 /* Check the newline before point for invisibility. */ |
4597 Lisp_Object prop; | 4590 { |
4598 | 4591 Lisp_Object prop; |
4599 /* Check the newline before point for invisibility. */ | 4592 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), |
4600 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), | |
4601 Qinvisible, it->window); | 4593 Qinvisible, it->window); |
4602 if (TEXT_PROP_MEANS_INVISIBLE (prop)) | 4594 if (TEXT_PROP_MEANS_INVISIBLE (prop)) |
4603 visible_p = 0; | 4595 continue; |
4604 } | 4596 } |
4605 | 4597 |
4606 #if 0 | 4598 /* If newline has a display property that replaces the newline with something |
4607 /* Commenting this out fixes the bug described in | 4599 else (image or text), find start of overlay or interval and continue search |
4608 http://www.math.ku.dk/~larsh/emacs/emacs-loops-on-large-images/test-case.txt. */ | 4600 from that point. */ |
4609 if (visible_p) | 4601 { |
4610 { | 4602 struct it it2 = *it; |
4611 struct it it2 = *it; | 4603 int pos = IT_CHARPOS (*it); |
4612 | 4604 int beg, end; |
4613 if (handle_display_prop (&it2) == HANDLED_RETURN) | 4605 Lisp_Object val, overlay; |
4614 visible_p = 0; | 4606 |
4615 } | 4607 if (handle_display_prop (&it2) == HANDLED_RETURN |
4616 #endif | 4608 && !NILP (val = get_char_property_and_overlay |
4617 | 4609 (make_number (pos), Qdisplay, Qnil, &overlay)) |
4618 /* Back one more newline if the current one is invisible. */ | 4610 && (OVERLAYP (overlay) |
4619 if (!visible_p) | 4611 ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay))) |
4620 back_to_previous_line_start (it); | 4612 : get_property_and_range (pos, Qdisplay, &val, &beg, &end, Qnil))) |
4613 { | |
4614 if (beg < BEGV) | |
4615 beg = BEGV; | |
4616 IT_CHARPOS (*it) = beg; | |
4617 IT_BYTEPOS (*it) = buf_charpos_to_bytepos (current_buffer, beg); | |
4618 continue; | |
4619 } | |
4620 } | |
4621 break; | |
4621 } | 4622 } |
4622 | 4623 |
4623 xassert (IT_CHARPOS (*it) >= BEGV); | 4624 xassert (IT_CHARPOS (*it) >= BEGV); |
4624 xassert (IT_CHARPOS (*it) == BEGV | 4625 xassert (IT_CHARPOS (*it) == BEGV |
4625 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); | 4626 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); |