comparison src/xdisp.c @ 30652:4ed1978642cb

(start_display): WHen starting display on a continuation line, clear ascent and descent members of the iterator structure; the height of the continued line does not affect the height of the continuation line. (make_cursor_line_fully_visible): Do nothing if cursor is on a line taller than the window. (redisplay_window) <forced window start>: Handle case that the middle of the window is not found in any row. (dump_glyph_row): Show more information. (compute_line_metrics): Use MATRIX_FIRST_TEXT_ROW to determine the first text line in a glyph matrix.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 07 Aug 2000 21:52:14 +0000
parents 0c3f7d0ebb82
children 8a516a1f76a7
comparison
equal deleted inserted replaced
30651:61c2f9fcb8f6 30652:4ed1978642cb
1485 /* If lines are continued, this line may end in the middle of a 1485 /* If lines are continued, this line may end in the middle of a
1486 multi-glyph character (e.g. a control character displayed as 1486 multi-glyph character (e.g. a control character displayed as
1487 \003, or in the middle of an overlay string). In this case 1487 \003, or in the middle of an overlay string). In this case
1488 move_it_to above will not have taken us to the start of 1488 move_it_to above will not have taken us to the start of
1489 the continuation line but to the end of the continued line. */ 1489 the continuation line but to the end of the continued line. */
1490 if (!it->truncate_lines_p && it->current_x > 0) 1490 if (!it->truncate_lines_p)
1491 { 1491 {
1492 if (it->current.dpvec_index >= 0 1492 if (it->current_x > 0)
1493 || it->current.overlay_string_index >= 0)
1494 { 1493 {
1495 set_iterator_to_next (it); 1494 if (it->current.dpvec_index >= 0
1496 move_it_in_display_line_to (it, -1, -1, 0); 1495 || it->current.overlay_string_index >= 0)
1496 {
1497 set_iterator_to_next (it);
1498 move_it_in_display_line_to (it, -1, -1, 0);
1499 }
1500
1501 it->continuation_lines_width += it->current_x;
1497 } 1502 }
1498 it->continuation_lines_width += it->current_x; 1503
1504 /* We're starting a new display line, not affected by the
1505 height of the continued line, so clear the appropriate
1506 fields in the iterator structure. */
1507 it->max_ascent = it->max_descent = 0;
1508 it->max_phys_ascent = it->max_phys_descent = 0;
1499 } 1509 }
1500 1510
1501 it->current_y = first_y; 1511 it->current_y = first_y;
1502 it->vpos = 0; 1512 it->vpos = 0;
1503 it->current_x = it->hpos = 0; 1513 it->current_x = it->hpos = 0;
8336 make_cursor_line_fully_visible (w) 8346 make_cursor_line_fully_visible (w)
8337 struct window *w; 8347 struct window *w;
8338 { 8348 {
8339 struct glyph_matrix *matrix; 8349 struct glyph_matrix *matrix;
8340 struct glyph_row *row; 8350 struct glyph_row *row;
8351 int window_height, header_line_height;
8341 8352
8342 /* It's not always possible to find the cursor, e.g, when a window 8353 /* It's not always possible to find the cursor, e.g, when a window
8343 is full of overlay strings. Don't do anything in that case. */ 8354 is full of overlay strings. Don't do anything in that case. */
8344 if (w->cursor.vpos < 0) 8355 if (w->cursor.vpos < 0)
8345 return; 8356 return;
8346 8357
8347 matrix = w->desired_matrix; 8358 matrix = w->desired_matrix;
8348 row = MATRIX_ROW (matrix, w->cursor.vpos); 8359 row = MATRIX_ROW (matrix, w->cursor.vpos);
8349 8360
8350 if (MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row) 8361 /* If the cursor row is not partially visible, there's nothing
8351 /* The row may be partially visible at the top because we 8362 to do. */
8352 already have chosen a vscroll to align the bottom of the 8363 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row))
8353 row with the bottom of the window. This happens for rows 8364 return;
8354 taller than the window. */ 8365
8355 && row->y + row->height < window_box_height (w)) 8366 /* If the row the cursor is in is taller than the window's height,
8367 it's not clear what to do, so do nothing. */
8368 window_height = window_box_height (w);
8369 if (row->height >= window_height)
8370 return;
8371
8372 if (MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row))
8356 { 8373 {
8357 int dy = row->height - row->visible_height; 8374 int dy = row->height - row->visible_height;
8358 w->vscroll = 0; 8375 w->vscroll = 0;
8359 w->cursor.y += dy; 8376 w->cursor.y += dy;
8360 shift_glyph_matrix (w, matrix, 0, matrix->nrows, dy); 8377 shift_glyph_matrix (w, matrix, 0, matrix->nrows, dy);
8361 } 8378 }
8362 else if (MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row) 8379 else /* MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row)) */
8363 /* The row may be partially visible at the bottom because
8364 we chose a vscroll to align the row's top with the
8365 window's top. This happens for rows taller than the
8366 window. */
8367 && row->y > WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w))
8368 { 8380 {
8369 int dy = - (row->height - row->visible_height); 8381 int dy = - (row->height - row->visible_height);
8370 w->vscroll = dy; 8382 w->vscroll = dy;
8371 w->cursor.y += dy; 8383 w->cursor.y += dy;
8372 shift_glyph_matrix (w, matrix, 0, matrix->nrows, dy); 8384 shift_glyph_matrix (w, matrix, 0, matrix->nrows, dy);
8373 } 8385 }
8374 8386
8375 /* When we change the cursor y-position of the selected window, 8387 /* When we change the cursor y-position of the selected window,
8376 change this_line_y as well so that the display optimization for 8388 change this_line_y as well so that the display optimization for
8377 the cursor line of the selected window in redisplay_internal uses 8389 the cursor line of the selected window in redisplay_internal uses
8378 the correct y-position. */ 8390 the correct y-position. */
8379 if (w == XWINDOW (selected_window)) 8391 if (w == XWINDOW (selected_window))
8900 goto restore_buffers; 8912 goto restore_buffers;
8901 } 8913 }
8902 8914
8903 if (w->cursor.vpos < 0 && !w->frozen_window_start_p) 8915 if (w->cursor.vpos < 0 && !w->frozen_window_start_p)
8904 { 8916 {
8905 /* If point does not appear, or on a line that is not fully 8917 /* If point does not appear, try to move point so it does
8906 visible, move point so it does appear. The desired 8918 appear. The desired matrix has been built above, so we
8907 matrix has been built above, so we can use it. */ 8919 can use it here. */
8908 int height = window_box_height (w) / 2; 8920 int window_height;
8909 struct glyph_row *row = MATRIX_ROW (w->desired_matrix, 0); 8921 struct glyph_row *row;
8910 8922
8911 while (row->y < height) 8923 window_height = window_box_height (w) / 2;
8924 row = MATRIX_FIRST_TEXT_ROW (w->desired_matrix);
8925 while (MATRIX_ROW_BOTTOM_Y (row) < window_height)
8912 ++row; 8926 ++row;
8913 8927
8914 TEMP_SET_PT_BOTH (MATRIX_ROW_START_CHARPOS (row), 8928 TEMP_SET_PT_BOTH (MATRIX_ROW_START_CHARPOS (row),
8915 MATRIX_ROW_START_BYTEPOS (row)); 8929 MATRIX_ROW_START_BYTEPOS (row));
8916 8930
10778 if (vpos < 0 || vpos >= matrix->nrows) 10792 if (vpos < 0 || vpos >= matrix->nrows)
10779 return; 10793 return;
10780 10794
10781 row = MATRIX_ROW (matrix, vpos); 10795 row = MATRIX_ROW (matrix, vpos);
10782 10796
10783 fprintf (stderr, "Row Start End Used oEI><O\\CTZFes X Y W\n"); 10797 fprintf (stderr, "Row Start End Used oEI><O\\CTZFes X Y W H V A P\n");
10784 fprintf (stderr, "=============================================\n"); 10798 fprintf (stderr, "=======================================================================\n");
10785 10799
10786 fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d\n", 10800 fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1 \
10801 1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n",
10787 row - matrix->rows, 10802 row - matrix->rows,
10788 MATRIX_ROW_START_CHARPOS (row), 10803 MATRIX_ROW_START_CHARPOS (row),
10789 MATRIX_ROW_END_CHARPOS (row), 10804 MATRIX_ROW_END_CHARPOS (row),
10790 row->used[TEXT_AREA], 10805 row->used[TEXT_AREA],
10791 row->contains_overlapping_glyphs_p, 10806 row->contains_overlapping_glyphs_p,
10801 row->fill_line_p, 10816 row->fill_line_p,
10802 row->ends_in_middle_of_char_p, 10817 row->ends_in_middle_of_char_p,
10803 row->starts_in_middle_of_char_p, 10818 row->starts_in_middle_of_char_p,
10804 row->x, 10819 row->x,
10805 row->y, 10820 row->y,
10806 row->pixel_width); 10821 row->pixel_width,
10822 row->height,
10823 row->visible_height,
10824 row->ascent,
10825 row->phys_ascent);
10807 fprintf (stderr, "%9d %5d\n", row->start.overlay_string_index, 10826 fprintf (stderr, "%9d %5d\n", row->start.overlay_string_index,
10808 row->end.overlay_string_index); 10827 row->end.overlay_string_index);
10809 fprintf (stderr, "%9d %5d\n", 10828 fprintf (stderr, "%9d %5d\n",
10810 CHARPOS (row->start.string_pos), 10829 CHARPOS (row->start.string_pos),
10811 CHARPOS (row->end.string_pos)); 10830 CHARPOS (row->end.string_pos));
11129 || MATRIX_ROW_OVERLAPS_PRED_P (row)); 11148 || MATRIX_ROW_OVERLAPS_PRED_P (row));
11130 11149
11131 /* If first line's physical ascent is larger than its logical 11150 /* If first line's physical ascent is larger than its logical
11132 ascent, use the physical ascent, and make the row taller. 11151 ascent, use the physical ascent, and make the row taller.
11133 This makes accented characters fully visible. */ 11152 This makes accented characters fully visible. */
11134 if (row == it->w->desired_matrix->rows 11153 if (row == MATRIX_FIRST_TEXT_ROW (it->w->desired_matrix)
11135 && row->phys_ascent > row->ascent) 11154 && row->phys_ascent > row->ascent)
11136 { 11155 {
11137 row->height += row->phys_ascent - row->ascent; 11156 row->height += row->phys_ascent - row->ascent;
11138 row->ascent = row->phys_ascent; 11157 row->ascent = row->phys_ascent;
11139 } 11158 }
11443 while (1) 11462 while (1)
11444 { 11463 {
11445 int n_glyphs_before, hpos_before, x_before; 11464 int n_glyphs_before, hpos_before, x_before;
11446 int x, i, nglyphs; 11465 int x, i, nglyphs;
11447 int ascent, descent, phys_ascent, phys_descent; 11466 int ascent, descent, phys_ascent, phys_descent;
11448 11467
11449 /* Retrieve the next thing to display. Value is zero if end of 11468 /* Retrieve the next thing to display. Value is zero if end of
11450 buffer reached. */ 11469 buffer reached. */
11451 if (!get_next_display_element (it)) 11470 if (!get_next_display_element (it))
11452 { 11471 {
11453 /* Maybe add a space at the end of this line that is used to 11472 /* Maybe add a space at the end of this line that is used to