diff options
| -rw-r--r-- | src/xdisp.c | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 2facc873743..bf06bba7df3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -4573,51 +4573,52 @@ 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 | |||
| 4578 | /* Go back one newline if not on BEGV already. */ | ||
| 4579 | if (IT_CHARPOS (*it) > BEGV) | ||
| 4580 | back_to_previous_line_start (it); | ||
| 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 | { | 4577 | { |
| 4587 | visible_p = 1; | 4578 | back_to_previous_line_start (it); |
| 4579 | if (IT_CHARPOS (*it) <= BEGV) | ||
| 4580 | break; | ||
| 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 | ||
| 4596 | { | ||
| 4597 | Lisp_Object prop; | ||
| 4598 | 4588 | ||
| 4599 | /* Check the newline before point for invisibility. */ | 4589 | /* Check the newline before point for invisibility. */ |
| 4600 | prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), | 4590 | { |
| 4591 | Lisp_Object prop; | ||
| 4592 | 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 | |||
| 4606 | #if 0 | ||
| 4607 | /* Commenting this out fixes the bug described in | ||
| 4608 | http://www.math.ku.dk/~larsh/emacs/emacs-loops-on-large-images/test-case.txt. */ | ||
| 4609 | if (visible_p) | ||
| 4610 | { | ||
| 4611 | struct it it2 = *it; | ||
| 4612 | |||
| 4613 | if (handle_display_prop (&it2) == HANDLED_RETURN) | ||
| 4614 | visible_p = 0; | ||
| 4615 | } | ||
| 4616 | #endif | ||
| 4617 | 4597 | ||
| 4618 | /* Back one more newline if the current one is invisible. */ | 4598 | /* If newline has a display property that replaces the newline with something |
| 4619 | if (!visible_p) | 4599 | else (image or text), find start of overlay or interval and continue search |
| 4620 | back_to_previous_line_start (it); | 4600 | from that point. */ |
| 4601 | { | ||
| 4602 | struct it it2 = *it; | ||
| 4603 | int pos = IT_CHARPOS (*it); | ||
| 4604 | int beg, end; | ||
| 4605 | Lisp_Object val, overlay; | ||
| 4606 | |||
| 4607 | if (handle_display_prop (&it2) == HANDLED_RETURN | ||
| 4608 | && !NILP (val = get_char_property_and_overlay | ||
| 4609 | (make_number (pos), Qdisplay, Qnil, &overlay)) | ||
| 4610 | && (OVERLAYP (overlay) | ||
| 4611 | ? (beg = OVERLAY_POSITION (OVERLAY_START (overlay))) | ||
| 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); |