diff options
| author | Gerd Moellmann | 2001-10-24 09:11:54 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-10-24 09:11:54 +0000 |
| commit | 0df56f4db76d364165d954c901e77560a6301d05 (patch) | |
| tree | cc5490c4db9cd019f8a27307f02ff3a211b20e0e /src | |
| parent | 229151baacb947e95fefae19451b2574b256e569 (diff) | |
| download | emacs-0df56f4db76d364165d954c901e77560a6301d05.tar.gz emacs-0df56f4db76d364165d954c901e77560a6301d05.zip | |
(try_window_reusing_current_matrix): Use
row_containing_pos.
(row_containing_pos): Take additional argument DY. Treat
rows ending in middle of char differently.
(display_line): Handle tabs on window systems differently.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 14413ca8f45..45b179a6ac6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -10705,26 +10705,11 @@ try_window_reusing_current_matrix (w) | |||
| 10705 | int dy = it.current_y - first_row_y; | 10705 | int dy = it.current_y - first_row_y; |
| 10706 | 10706 | ||
| 10707 | row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 10707 | row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
| 10708 | while (MATRIX_ROW_DISPLAYS_TEXT_P (row)) | 10708 | row = row_containing_pos (w, PT, row, NULL, dy); |
| 10709 | { | 10709 | if (row) |
| 10710 | if (PT >= MATRIX_ROW_START_CHARPOS (row) | 10710 | set_cursor_from_row (w, row, w->current_matrix, 0, 0, |
| 10711 | && PT < MATRIX_ROW_END_CHARPOS (row)) | 10711 | dy, nrows_scrolled); |
| 10712 | { | 10712 | else |
| 10713 | set_cursor_from_row (w, row, w->current_matrix, 0, 0, | ||
| 10714 | dy, nrows_scrolled); | ||
| 10715 | break; | ||
| 10716 | } | ||
| 10717 | |||
| 10718 | if (MATRIX_ROW_BOTTOM_Y (row) + dy >= it.last_visible_y) | ||
| 10719 | break; | ||
| 10720 | |||
| 10721 | ++row; | ||
| 10722 | } | ||
| 10723 | |||
| 10724 | /* Give up if point was not found. This shouldn't | ||
| 10725 | happen often; not more often than with try_window | ||
| 10726 | itself. */ | ||
| 10727 | if (w->cursor.vpos < 0) | ||
| 10728 | { | 10713 | { |
| 10729 | clear_glyph_matrix (w->desired_matrix); | 10714 | clear_glyph_matrix (w->desired_matrix); |
| 10730 | return 0; | 10715 | return 0; |
| @@ -11200,10 +11185,11 @@ sync_frame_with_window_matrix_rows (w) | |||
| 11200 | containing CHARPOS or null. */ | 11185 | containing CHARPOS or null. */ |
| 11201 | 11186 | ||
| 11202 | struct glyph_row * | 11187 | struct glyph_row * |
| 11203 | row_containing_pos (w, charpos, start, end) | 11188 | row_containing_pos (w, charpos, start, end, dy) |
| 11204 | struct window *w; | 11189 | struct window *w; |
| 11205 | int charpos; | 11190 | int charpos; |
| 11206 | struct glyph_row *start, *end; | 11191 | struct glyph_row *start, *end; |
| 11192 | int dy; | ||
| 11207 | { | 11193 | { |
| 11208 | struct glyph_row *row = start; | 11194 | struct glyph_row *row = start; |
| 11209 | int last_y; | 11195 | int last_y; |
| @@ -11215,18 +11201,18 @@ row_containing_pos (w, charpos, start, end) | |||
| 11215 | if ((end && row >= end) || !row->enabled_p) | 11201 | if ((end && row >= end) || !row->enabled_p) |
| 11216 | return NULL; | 11202 | return NULL; |
| 11217 | 11203 | ||
| 11218 | last_y = window_text_bottom_y (w); | 11204 | last_y = window_text_bottom_y (w) - dy; |
| 11219 | 11205 | ||
| 11220 | while ((end == NULL || row < end) | 11206 | while ((end == NULL || row < end) |
| 11207 | && MATRIX_ROW_BOTTOM_Y (row) < last_y | ||
| 11221 | && (MATRIX_ROW_END_CHARPOS (row) < charpos | 11208 | && (MATRIX_ROW_END_CHARPOS (row) < charpos |
| 11222 | /* The end position of a row equals the start | ||
| 11223 | position of the next row. If CHARPOS is there, we | ||
| 11224 | would rather display it in the next line, except | ||
| 11225 | when this line ends in ZV. */ | ||
| 11226 | || (MATRIX_ROW_END_CHARPOS (row) == charpos | 11209 | || (MATRIX_ROW_END_CHARPOS (row) == charpos |
| 11227 | && (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row) | 11210 | /* The end position of a row equals the start |
| 11228 | || !row->ends_at_zv_p))) | 11211 | position of the next row. If CHARPOS is there, we |
| 11229 | && MATRIX_ROW_BOTTOM_Y (row) < last_y) | 11212 | would rather display it in the next line, except |
| 11213 | when this line ends in ZV. */ | ||
| 11214 | && !row->ends_at_zv_p | ||
| 11215 | && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))) | ||
| 11230 | ++row; | 11216 | ++row; |
| 11231 | 11217 | ||
| 11232 | /* Give up if CHARPOS not found. */ | 11218 | /* Give up if CHARPOS not found. */ |
| @@ -11435,7 +11421,7 @@ try_window_id (w) | |||
| 11435 | } | 11421 | } |
| 11436 | 11422 | ||
| 11437 | /* Set the cursor. */ | 11423 | /* Set the cursor. */ |
| 11438 | row = row_containing_pos (w, PT, r0, NULL); | 11424 | row = row_containing_pos (w, PT, r0, NULL, 0); |
| 11439 | set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); | 11425 | set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); |
| 11440 | return 1; | 11426 | return 1; |
| 11441 | } | 11427 | } |
| @@ -11473,7 +11459,7 @@ try_window_id (w) | |||
| 11473 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); | 11459 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); |
| 11474 | 11460 | ||
| 11475 | /* Set the cursor. */ | 11461 | /* Set the cursor. */ |
| 11476 | row = row_containing_pos (w, PT, r0, NULL); | 11462 | row = row_containing_pos (w, PT, r0, NULL, 0); |
| 11477 | set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); | 11463 | set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); |
| 11478 | return 2; | 11464 | return 2; |
| 11479 | } | 11465 | } |
| @@ -11672,7 +11658,7 @@ try_window_id (w) | |||
| 11672 | { | 11658 | { |
| 11673 | row = row_containing_pos (w, PT, | 11659 | row = row_containing_pos (w, PT, |
| 11674 | MATRIX_FIRST_TEXT_ROW (w->current_matrix), | 11660 | MATRIX_FIRST_TEXT_ROW (w->current_matrix), |
| 11675 | last_unchanged_at_beg_row + 1); | 11661 | last_unchanged_at_beg_row + 1, 0); |
| 11676 | if (row) | 11662 | if (row) |
| 11677 | set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); | 11663 | set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); |
| 11678 | } | 11664 | } |
| @@ -11681,7 +11667,7 @@ try_window_id (w) | |||
| 11681 | else if (first_unchanged_at_end_row) | 11667 | else if (first_unchanged_at_end_row) |
| 11682 | { | 11668 | { |
| 11683 | row = row_containing_pos (w, PT - delta, | 11669 | row = row_containing_pos (w, PT - delta, |
| 11684 | first_unchanged_at_end_row, NULL); | 11670 | first_unchanged_at_end_row, NULL, 0); |
| 11685 | if (row) | 11671 | if (row) |
| 11686 | set_cursor_from_row (w, row, w->current_matrix, delta, | 11672 | set_cursor_from_row (w, row, w->current_matrix, delta, |
| 11687 | delta_bytes, dy, dvpos); | 11673 | delta_bytes, dy, dvpos); |
| @@ -12945,11 +12931,24 @@ display_line (it) | |||
| 12945 | it->max_phys_ascent = phys_ascent; | 12931 | it->max_phys_ascent = phys_ascent; |
| 12946 | it->max_phys_descent = phys_descent; | 12932 | it->max_phys_descent = phys_descent; |
| 12947 | } | 12933 | } |
| 12934 | else if (it->c == '\t' && FRAME_WINDOW_P (it->f)) | ||
| 12935 | { | ||
| 12936 | /* A TAB that extends past the right edge of the | ||
| 12937 | window. This produces a single glyph on | ||
| 12938 | window system frames. We leave the glyph in | ||
| 12939 | this row and let it fill the row, but don't | ||
| 12940 | consume the TAB. */ | ||
| 12941 | it->continuation_lines_width += it->last_visible_x; | ||
| 12942 | row->ends_in_middle_of_char_p = 1; | ||
| 12943 | row->continued_p = 1; | ||
| 12944 | glyph->pixel_width = it->last_visible_x - x; | ||
| 12945 | it->starts_in_middle_of_char_p = 1; | ||
| 12946 | } | ||
| 12948 | else | 12947 | else |
| 12949 | { | 12948 | { |
| 12950 | /* Display element draws past the right edge of | 12949 | /* Something other than a TAB that draws past |
| 12951 | the window. Restore positions to values | 12950 | the right edge of the window. Restore |
| 12952 | before the element. */ | 12951 | positions to values before the element. */ |
| 12953 | row->used[TEXT_AREA] = n_glyphs_before + i; | 12952 | row->used[TEXT_AREA] = n_glyphs_before + i; |
| 12954 | 12953 | ||
| 12955 | /* Display continuation glyphs. */ | 12954 | /* Display continuation glyphs. */ |
| @@ -12957,14 +12956,7 @@ display_line (it) | |||
| 12957 | produce_special_glyphs (it, IT_CONTINUATION); | 12956 | produce_special_glyphs (it, IT_CONTINUATION); |
| 12958 | row->continued_p = 1; | 12957 | row->continued_p = 1; |
| 12959 | 12958 | ||
| 12960 | /* A TAB takes us to the right edge of the window. */ | 12959 | it->continuation_lines_width += x; |
| 12961 | if (it->c == '\t') | ||
| 12962 | { | ||
| 12963 | it->continuation_lines_width += it->last_visible_x; | ||
| 12964 | row->ends_in_middle_of_char_p = 1; | ||
| 12965 | } | ||
| 12966 | else | ||
| 12967 | it->continuation_lines_width += x; | ||
| 12968 | 12960 | ||
| 12969 | if (nglyphs > 1 && i > 0) | 12961 | if (nglyphs > 1 && i > 0) |
| 12970 | { | 12962 | { |