From 17fdcfc85dfad70b0e52221bd36bc6a90ec68d33 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Tue, 7 Aug 2001 11:37:10 +0000 Subject: [PATCH] (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. --- src/ChangeLog | 7 +++++++ src/xdisp.c | 54 ++++++++++++++++++++++++--------------------------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index eaaa46952eb..1e9f0977f61 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2001-08-07 Gerd Moellmann + + * xdisp.c (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. + 2001-08-06 Gerd Moellmann * xterm.c (x_dump_glyph_string): Put in #if GLYPH_DEBUG. diff --git a/src/xdisp.c b/src/xdisp.c index 88d85803617..b5a28cb826a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1705,36 +1705,32 @@ start_display (it, w, pos) struct window *w; struct text_pos pos; { - int start_at_line_beg_p; struct glyph_row *row; int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; - int first_y; row = w->desired_matrix->rows + first_vpos; init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID); - first_y = it->current_y; - - /* If window start is not at a line start, move back to the line - start. This makes sure that we take continuation lines into - account. */ - start_at_line_beg_p = (CHARPOS (pos) == BEGV - || FETCH_BYTE (BYTEPOS (pos) - 1) == '\n'); - if (!start_at_line_beg_p) - reseat_at_previous_visible_line_start (it); - - /* If window start is not at a line start, skip forward to POS to - get the correct continuation_lines_width and current_x. */ - if (!start_at_line_beg_p) - { - move_it_to (it, CHARPOS (pos), -1, -1, -1, MOVE_TO_POS); - - /* If lines are continued, this line may end in the middle of a - multi-glyph character (e.g. a control character displayed as - \003, or in the middle of an overlay string). In this case - move_it_to above will not have taken us to the start of - the continuation line but to the end of the continued line. */ - if (!it->truncate_lines_p) + + if (!it->truncate_lines_p) + { + int start_at_line_beg_p; + int first_y = it->current_y; + + /* If window start is not at a line start, skip forward to POS to + get the correct continuation lines width. */ + start_at_line_beg_p = (CHARPOS (pos) == BEGV + || FETCH_BYTE (BYTEPOS (pos) - 1) == '\n'); + if (!start_at_line_beg_p) { + reseat_at_previous_visible_line_start (it); + move_it_to (it, CHARPOS (pos), -1, -1, -1, MOVE_TO_POS); + + /* If lines are continued, this line may end in the middle + of a multi-glyph character (e.g. a control character + displayed as \003, or in the middle of an overlay + string). In this case move_it_to above will not have + taken us to the start of the continuation line but to the + end of the continued line. */ if (it->current_x > 0) { if (it->current.dpvec_index >= 0 @@ -1743,7 +1739,7 @@ start_display (it, w, pos) set_iterator_to_next (it, 1); move_it_in_display_line_to (it, -1, -1, 0); } - + it->continuation_lines_width += it->current_x; } @@ -1752,11 +1748,11 @@ start_display (it, w, pos) fields in the iterator structure. */ it->max_ascent = it->max_descent = 0; it->max_phys_ascent = it->max_phys_descent = 0; - } - it->current_y = first_y; - it->vpos = 0; - it->current_x = it->hpos = 0; + it->current_y = first_y; + it->vpos = 0; + it->current_x = it->hpos = 0; + } } #if 0 /* Don't assert the following because start_display is sometimes -- 2.39.2