diff options
| author | Richard M. Stallman | 2005-01-01 01:34:22 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-01-01 01:34:22 +0000 |
| commit | f323e507d04d854d6626e1971d740a22600f4c67 (patch) | |
| tree | 0fce089020e2e64a6805948ac1ca3daa74c08a53 /src | |
| parent | 553fd77e2511cdc4d1b45933f237c724ee72c3b9 (diff) | |
| download | emacs-f323e507d04d854d6626e1971d740a22600f4c67.tar.gz emacs-f323e507d04d854d6626e1971d740a22600f4c67.zip | |
(setup_for_ellipsis, get_next_display_element):
Set it->ellipsis_p to 1 or 0.
(display_line): Record whether row ends in mid-ellipsis.
(set_cursor_from_row): If ends in ellipsis. find start of it.
(cursor_row_p): If PT's at the end of the ellipsis the row
ends within, don't display cursor on this row.
(BUFFER_POS_REACHED_P): We haven't reached the specified
position if we're reading from something other than the buffer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 61ea98b37ef..91ef0249045 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3270,6 +3270,7 @@ setup_for_ellipsis (it, len) | |||
| 3270 | IT's face is restored in set_iterator_to_next. */ | 3270 | IT's face is restored in set_iterator_to_next. */ |
| 3271 | it->saved_face_id = it->face_id; | 3271 | it->saved_face_id = it->face_id; |
| 3272 | it->method = next_element_from_display_vector; | 3272 | it->method = next_element_from_display_vector; |
| 3273 | it->ellipsis_p = 1; | ||
| 3273 | } | 3274 | } |
| 3274 | 3275 | ||
| 3275 | 3276 | ||
| @@ -4912,6 +4913,7 @@ get_next_display_element (it) | |||
| 4912 | it->current.dpvec_index = 0; | 4913 | it->current.dpvec_index = 0; |
| 4913 | it->saved_face_id = it->face_id; | 4914 | it->saved_face_id = it->face_id; |
| 4914 | it->method = next_element_from_display_vector; | 4915 | it->method = next_element_from_display_vector; |
| 4916 | it->ellipsis_p = 0; | ||
| 4915 | } | 4917 | } |
| 4916 | else | 4918 | else |
| 4917 | { | 4919 | { |
| @@ -5062,6 +5064,7 @@ get_next_display_element (it) | |||
| 5062 | it->current.dpvec_index = 0; | 5064 | it->current.dpvec_index = 0; |
| 5063 | it->saved_face_id = it->face_id; | 5065 | it->saved_face_id = it->face_id; |
| 5064 | it->method = next_element_from_display_vector; | 5066 | it->method = next_element_from_display_vector; |
| 5067 | it->ellipsis_p = 0; | ||
| 5065 | goto get_next; | 5068 | goto get_next; |
| 5066 | } | 5069 | } |
| 5067 | } | 5070 | } |
| @@ -5703,10 +5706,11 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) | |||
| 5703 | saved_glyph_row = it->glyph_row; | 5706 | saved_glyph_row = it->glyph_row; |
| 5704 | it->glyph_row = NULL; | 5707 | it->glyph_row = NULL; |
| 5705 | 5708 | ||
| 5706 | #define BUFFER_POS_REACHED_P() \ | 5709 | #define BUFFER_POS_REACHED_P() \ |
| 5707 | ((op & MOVE_TO_POS) != 0 \ | 5710 | ((op & MOVE_TO_POS) != 0 \ |
| 5708 | && BUFFERP (it->object) \ | 5711 | && BUFFERP (it->object) \ |
| 5709 | && IT_CHARPOS (*it) >= to_charpos) | 5712 | && IT_CHARPOS (*it) >= to_charpos \ |
| 5713 | && it->method == next_element_from_buffer) | ||
| 5710 | 5714 | ||
| 5711 | while (1) | 5715 | while (1) |
| 5712 | { | 5716 | { |
| @@ -10812,6 +10816,18 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 10812 | glyph = cursor; | 10816 | glyph = cursor; |
| 10813 | x = cursor_x; | 10817 | x = cursor_x; |
| 10814 | } | 10818 | } |
| 10819 | else if (row->ends_in_ellipsis_p && glyph == end) | ||
| 10820 | { | ||
| 10821 | /* Scan back over the ellipsis glyphs, decrementing positions. */ | ||
| 10822 | while (glyph > row->glyphs[TEXT_AREA] | ||
| 10823 | && (glyph - 1)->charpos == last_pos) | ||
| 10824 | glyph--, x -= glyph->pixel_width; | ||
| 10825 | /* That loop always goes one position too far, | ||
| 10826 | including the glyph before the ellipsis. | ||
| 10827 | So scan forward over that one. */ | ||
| 10828 | x += glyph->pixel_width; | ||
| 10829 | glyph++; | ||
| 10830 | } | ||
| 10815 | else if (string_start | 10831 | else if (string_start |
| 10816 | && (glyph == end || !BUFFERP (glyph->object) || last_pos > pt_old)) | 10832 | && (glyph == end || !BUFFERP (glyph->object) || last_pos > pt_old)) |
| 10817 | { | 10833 | { |
| @@ -14613,10 +14629,22 @@ cursor_row_p (w, row) | |||
| 14613 | /* If the row ends with a newline from a string, we don't want | 14629 | /* If the row ends with a newline from a string, we don't want |
| 14614 | the cursor there (if the row is continued it doesn't end in a | 14630 | the cursor there (if the row is continued it doesn't end in a |
| 14615 | newline). */ | 14631 | newline). */ |
| 14616 | if (CHARPOS (row->end.string_pos) >= 0 | 14632 | if (CHARPOS (row->end.string_pos) >= 0) |
| 14617 | || MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) | ||
| 14618 | cursor_row_p = row->continued_p; | 14633 | cursor_row_p = row->continued_p; |
| 14619 | 14634 | else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) | |
| 14635 | { | ||
| 14636 | /* If the row ends in middle of a real character, | ||
| 14637 | and the line is continued, we want the cursor here. | ||
| 14638 | That's because MATRIX_ROW_END_CHARPOS would equal | ||
| 14639 | PT if PT is before the character. */ | ||
| 14640 | if (!row->ends_in_ellipsis_p) | ||
| 14641 | cursor_row_p = row->continued_p; | ||
| 14642 | else | ||
| 14643 | /* If the row ends in an ellipsis, then | ||
| 14644 | MATRIX_ROW_END_CHARPOS will equal point after the invisible text. | ||
| 14645 | We want that position to be displayed after the ellipsis. */ | ||
| 14646 | cursor_row_p = 0; | ||
| 14647 | } | ||
| 14620 | /* If the row ends at ZV, display the cursor at the end of that | 14648 | /* If the row ends at ZV, display the cursor at the end of that |
| 14621 | row instead of at the start of the row below. */ | 14649 | row instead of at the start of the row below. */ |
| 14622 | else if (row->ends_at_zv_p) | 14650 | else if (row->ends_at_zv_p) |
| @@ -15093,6 +15121,11 @@ display_line (it) | |||
| 15093 | /* Remember the position at which this line ends. */ | 15121 | /* Remember the position at which this line ends. */ |
| 15094 | row->end = it->current; | 15122 | row->end = it->current; |
| 15095 | 15123 | ||
| 15124 | /* Record whether this row ends inside an ellipsis. */ | ||
| 15125 | row->ends_in_ellipsis_p | ||
| 15126 | = (it->method == next_element_from_display_vector | ||
| 15127 | && it->ellipsis_p); | ||
| 15128 | |||
| 15096 | /* Save fringe bitmaps in this row. */ | 15129 | /* Save fringe bitmaps in this row. */ |
| 15097 | row->left_user_fringe_bitmap = it->left_user_fringe_bitmap; | 15130 | row->left_user_fringe_bitmap = it->left_user_fringe_bitmap; |
| 15098 | row->left_user_fringe_face_id = it->left_user_fringe_face_id; | 15131 | row->left_user_fringe_face_id = it->left_user_fringe_face_id; |