comparison src/xdisp.c @ 29473:80835e075d87

(display_line): Set row's and iterator's starts_in_middle_of_char_p and ends_in_middle_of_char_p flags. Set cursor even if row ends in the middle of a character. (dump_glyph_row): Print values of new flags. (redisplay_window) <cursor movement in unchanged window>: When point has been moved forward, and PT is at the end of the cursor row, don't place the cursor in the next row if the cursor row ends in the middle of a character or at ZV.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 06 Jun 2000 20:02:39 +0000
parents 159e43bc7e3c
children b36d76033c9d
comparison
equal deleted inserted replaced
29472:9c2d98569dca 29473:80835e075d87
8833 if (PT > XFASTINT (w->last_point)) 8833 if (PT > XFASTINT (w->last_point))
8834 { 8834 {
8835 /* Point has moved forward. */ 8835 /* Point has moved forward. */
8836 int last_y = window_text_bottom_y (w) - this_scroll_margin; 8836 int last_y = window_text_bottom_y (w) - this_scroll_margin;
8837 8837
8838 while ((MATRIX_ROW_END_CHARPOS (row) < PT 8838 while (MATRIX_ROW_END_CHARPOS (row) < PT
8839 /* The end position of a row equals the start
8840 position of the next row. If PT is there, we
8841 would rather display it in the next line, except
8842 when this line ends in ZV. */
8843 || (MATRIX_ROW_END_CHARPOS (row) == PT
8844 && (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)
8845 || !row->ends_at_zv_p)))
8846 && MATRIX_ROW_BOTTOM_Y (row) < last_y) 8839 && MATRIX_ROW_BOTTOM_Y (row) < last_y)
8840 {
8841 xassert (row->enabled_p);
8842 ++row;
8843 }
8844
8845 /* The end position of a row equals the start position of
8846 the next row. If PT is there, we would rather display it
8847 in the next line. Exceptions are when the row ends in
8848 the middle of a character, or ends in ZV. */
8849 if (MATRIX_ROW_BOTTOM_Y (row) < last_y
8850 && MATRIX_ROW_END_CHARPOS (row) == PT
8851 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)
8852 && !row->ends_at_zv_p)
8847 { 8853 {
8848 xassert (row->enabled_p); 8854 xassert (row->enabled_p);
8849 ++row; 8855 ++row;
8850 } 8856 }
8851 8857
10584 if (vpos < 0 || vpos >= matrix->nrows) 10590 if (vpos < 0 || vpos >= matrix->nrows)
10585 return; 10591 return;
10586 10592
10587 row = MATRIX_ROW (matrix, vpos); 10593 row = MATRIX_ROW (matrix, vpos);
10588 10594
10589 fprintf (stderr, "Row Start End Used oEI><O\\CTZF X Y W\n"); 10595 fprintf (stderr, "Row Start End Used oEI><O\\CTZFes X Y W\n");
10590 fprintf (stderr, "=============================================\n"); 10596 fprintf (stderr, "=============================================\n");
10591 10597
10592 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 %4d %4d %4d\n", 10598 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",
10593 row - matrix->rows, 10599 row - matrix->rows,
10594 MATRIX_ROW_START_CHARPOS (row), 10600 MATRIX_ROW_START_CHARPOS (row),
10595 MATRIX_ROW_END_CHARPOS (row), 10601 MATRIX_ROW_END_CHARPOS (row),
10596 row->used[TEXT_AREA], 10602 row->used[TEXT_AREA],
10597 row->contains_overlapping_glyphs_p, 10603 row->contains_overlapping_glyphs_p,
10603 row->continued_p, 10609 row->continued_p,
10604 MATRIX_ROW_CONTINUATION_LINE_P (row), 10610 MATRIX_ROW_CONTINUATION_LINE_P (row),
10605 row->displays_text_p, 10611 row->displays_text_p,
10606 row->ends_at_zv_p, 10612 row->ends_at_zv_p,
10607 row->fill_line_p, 10613 row->fill_line_p,
10614 row->ends_in_middle_of_char_p,
10615 row->starts_in_middle_of_char_p,
10608 row->x, 10616 row->x,
10609 row->y, 10617 row->y,
10610 row->pixel_width); 10618 row->pixel_width);
10611 fprintf (stderr, "%9d %5d\n", row->start.overlay_string_index, 10619 fprintf (stderr, "%9d %5d\n", row->start.overlay_string_index,
10612 row->end.overlay_string_index); 10620 row->end.overlay_string_index);
11201 11209
11202 row->y = it->current_y; 11210 row->y = it->current_y;
11203 row->start = it->current; 11211 row->start = it->current;
11204 row->continuation_lines_width = it->continuation_lines_width; 11212 row->continuation_lines_width = it->continuation_lines_width;
11205 row->displays_text_p = 1; 11213 row->displays_text_p = 1;
11214 row->starts_in_middle_of_char_p = it->starts_in_middle_of_char_p;
11215 it->starts_in_middle_of_char_p = 0;
11206 11216
11207 /* Arrange the overlays nicely for our purposes. Usually, we call 11217 /* Arrange the overlays nicely for our purposes. Usually, we call
11208 display_line on only one line at a time, in which case this 11218 display_line on only one line at a time, in which case this
11209 can't really hurt too much, or we call it on lines which appear 11219 can't really hurt too much, or we call it on lines which appear
11210 one after another in the buffer, in which case all calls to 11220 one after another in the buffer, in which case all calls to
11385 produce_special_glyphs (it, IT_CONTINUATION); 11395 produce_special_glyphs (it, IT_CONTINUATION);
11386 row->continued_p = 1; 11396 row->continued_p = 1;
11387 11397
11388 it->current_x = x; 11398 it->current_x = x;
11389 it->continuation_lines_width += x; 11399 it->continuation_lines_width += x;
11400 if (nglyphs > 1 && i > 0)
11401 {
11402 row->ends_in_middle_of_char_p = 1;
11403 it->starts_in_middle_of_char_p = 1;
11404 }
11390 11405
11391 /* Restore the height to what it was before the 11406 /* Restore the height to what it was before the
11392 element not fitting on the line. */ 11407 element not fitting on the line. */
11393 it->max_ascent = ascent; 11408 it->max_ascent = ascent;
11394 it->max_descent = descent; 11409 it->max_descent = descent;
11536 compute_line_metrics (it); 11551 compute_line_metrics (it);
11537 11552
11538 /* Remember the position at which this line ends. */ 11553 /* Remember the position at which this line ends. */
11539 row->end = it->current; 11554 row->end = it->current;
11540 11555
11541 /* Maybe set the cursor. If you change this, it's probably a good 11556 /* Maybe set the cursor. We want to set the cursor on the first
11542 idea to also change the code in redisplay_window for cursor 11557 glyph having position PT. This means it doesn't matter if the
11543 movement in an unchanged window. */ 11558 row is continued and ends in the middle of the character at PT.
11559 If some glyphs of that character are in this row, this is the
11560 right row to put the cursor on. */
11544 if (it->w->cursor.vpos < 0 11561 if (it->w->cursor.vpos < 0
11545 && PT >= MATRIX_ROW_START_CHARPOS (row) 11562 && PT >= MATRIX_ROW_START_CHARPOS (row)
11546 && MATRIX_ROW_END_CHARPOS (row) >= PT 11563 && PT <= MATRIX_ROW_END_CHARPOS (row)
11547 && !(MATRIX_ROW_END_CHARPOS (row) == PT 11564 && !(PT == ZV && !row->ends_at_zv_p))
11548 && (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)
11549 || !row->ends_at_zv_p)))
11550 set_cursor_from_row (it->w, row, it->w->desired_matrix, 0, 0, 0, 0); 11565 set_cursor_from_row (it->w, row, it->w->desired_matrix, 0, 0, 0, 0);
11551 11566
11552 /* Highlight trailing whitespace. */ 11567 /* Highlight trailing whitespace. */
11553 if (!NILP (Vshow_trailing_whitespace)) 11568 if (!NILP (Vshow_trailing_whitespace))
11554 highlight_trailing_whitespace (it->f, it->glyph_row); 11569 highlight_trailing_whitespace (it->f, it->glyph_row);