Mercurial > emacs
comparison src/xdisp.c @ 38717:152fbfce2115
(start_display): Don't try to determine the continuation
lines width if lines are truncated. It's superfluous and leads to
incorrect results if POS is not visible in the window after
reseating the iterator at the previous line start.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 07 Aug 2001 11:36:43 +0000 |
parents | d22bb212fc40 |
children | 258f3e803e75 |
comparison
equal
deleted
inserted
replaced
38716:950c1c407830 | 38717:152fbfce2115 |
---|---|
1703 start_display (it, w, pos) | 1703 start_display (it, w, pos) |
1704 struct it *it; | 1704 struct it *it; |
1705 struct window *w; | 1705 struct window *w; |
1706 struct text_pos pos; | 1706 struct text_pos pos; |
1707 { | 1707 { |
1708 int start_at_line_beg_p; | |
1709 struct glyph_row *row; | 1708 struct glyph_row *row; |
1710 int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; | 1709 int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; |
1711 int first_y; | |
1712 | 1710 |
1713 row = w->desired_matrix->rows + first_vpos; | 1711 row = w->desired_matrix->rows + first_vpos; |
1714 init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID); | 1712 init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID); |
1715 first_y = it->current_y; | 1713 |
1716 | 1714 if (!it->truncate_lines_p) |
1717 /* If window start is not at a line start, move back to the line | 1715 { |
1718 start. This makes sure that we take continuation lines into | 1716 int start_at_line_beg_p; |
1719 account. */ | 1717 int first_y = it->current_y; |
1720 start_at_line_beg_p = (CHARPOS (pos) == BEGV | 1718 |
1721 || FETCH_BYTE (BYTEPOS (pos) - 1) == '\n'); | 1719 /* If window start is not at a line start, skip forward to POS to |
1722 if (!start_at_line_beg_p) | 1720 get the correct continuation lines width. */ |
1723 reseat_at_previous_visible_line_start (it); | 1721 start_at_line_beg_p = (CHARPOS (pos) == BEGV |
1724 | 1722 || FETCH_BYTE (BYTEPOS (pos) - 1) == '\n'); |
1725 /* If window start is not at a line start, skip forward to POS to | 1723 if (!start_at_line_beg_p) |
1726 get the correct continuation_lines_width and current_x. */ | 1724 { |
1727 if (!start_at_line_beg_p) | 1725 reseat_at_previous_visible_line_start (it); |
1728 { | 1726 move_it_to (it, CHARPOS (pos), -1, -1, -1, MOVE_TO_POS); |
1729 move_it_to (it, CHARPOS (pos), -1, -1, -1, MOVE_TO_POS); | 1727 |
1730 | 1728 /* If lines are continued, this line may end in the middle |
1731 /* If lines are continued, this line may end in the middle of a | 1729 of a multi-glyph character (e.g. a control character |
1732 multi-glyph character (e.g. a control character displayed as | 1730 displayed as \003, or in the middle of an overlay |
1733 \003, or in the middle of an overlay string). In this case | 1731 string). In this case move_it_to above will not have |
1734 move_it_to above will not have taken us to the start of | 1732 taken us to the start of the continuation line but to the |
1735 the continuation line but to the end of the continued line. */ | 1733 end of the continued line. */ |
1736 if (!it->truncate_lines_p) | |
1737 { | |
1738 if (it->current_x > 0) | 1734 if (it->current_x > 0) |
1739 { | 1735 { |
1740 if (it->current.dpvec_index >= 0 | 1736 if (it->current.dpvec_index >= 0 |
1741 || it->current.overlay_string_index >= 0) | 1737 || it->current.overlay_string_index >= 0) |
1742 { | 1738 { |
1743 set_iterator_to_next (it, 1); | 1739 set_iterator_to_next (it, 1); |
1744 move_it_in_display_line_to (it, -1, -1, 0); | 1740 move_it_in_display_line_to (it, -1, -1, 0); |
1745 } | 1741 } |
1746 | 1742 |
1747 it->continuation_lines_width += it->current_x; | 1743 it->continuation_lines_width += it->current_x; |
1748 } | 1744 } |
1749 | 1745 |
1750 /* We're starting a new display line, not affected by the | 1746 /* We're starting a new display line, not affected by the |
1751 height of the continued line, so clear the appropriate | 1747 height of the continued line, so clear the appropriate |
1752 fields in the iterator structure. */ | 1748 fields in the iterator structure. */ |
1753 it->max_ascent = it->max_descent = 0; | 1749 it->max_ascent = it->max_descent = 0; |
1754 it->max_phys_ascent = it->max_phys_descent = 0; | 1750 it->max_phys_ascent = it->max_phys_descent = 0; |
1755 } | |
1756 | 1751 |
1757 it->current_y = first_y; | 1752 it->current_y = first_y; |
1758 it->vpos = 0; | 1753 it->vpos = 0; |
1759 it->current_x = it->hpos = 0; | 1754 it->current_x = it->hpos = 0; |
1755 } | |
1760 } | 1756 } |
1761 | 1757 |
1762 #if 0 /* Don't assert the following because start_display is sometimes | 1758 #if 0 /* Don't assert the following because start_display is sometimes |
1763 called intentionally with a window start that is not at a | 1759 called intentionally with a window start that is not at a |
1764 line start. Please leave this code in as a comment. */ | 1760 line start. Please leave this code in as a comment. */ |