Mercurial > emacs
comparison src/xdisp.c @ 59267:c3661af44571
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 01 Jan 2005 01:34:22 +0000 |
parents | 6335ecadf31d |
children | 63100bba6ef9 f6b4d0ebf147 |
comparison
equal
deleted
inserted
replaced
59266:b462b7b828d1 | 59267:c3661af44571 |
---|---|
3268 | 3268 |
3269 /* Remember the current face id in case glyphs specify faces. | 3269 /* Remember the current face id in case glyphs specify faces. |
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 |
3276 | 3277 |
3277 /*********************************************************************** | 3278 /*********************************************************************** |
4910 it->dpvec = v->contents; | 4911 it->dpvec = v->contents; |
4911 it->dpend = v->contents + v->size; | 4912 it->dpend = v->contents + v->size; |
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 { |
4918 set_iterator_to_next (it, 0); | 4920 set_iterator_to_next (it, 0); |
4919 } | 4921 } |
5060 it->dpvec = it->ctl_chars; | 5062 it->dpvec = it->ctl_chars; |
5061 it->dpend = it->dpvec + ctl_len; | 5063 it->dpend = it->dpvec + ctl_len; |
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 } |
5068 | 5071 |
5069 /* Adjust face id for a multibyte character. There are no | 5072 /* Adjust face id for a multibyte character. There are no |
5701 | 5704 |
5702 /* Don't produce glyphs in produce_glyphs. */ | 5705 /* Don't produce glyphs in produce_glyphs. */ |
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 { |
5713 int x, i, ascent = 0, descent = 0; | 5717 int x, i, ascent = 0, descent = 0; |
5714 | 5718 |
10810 if (cursor != NULL) | 10814 if (cursor != NULL) |
10811 { | 10815 { |
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 { |
10818 /* We may have skipped over point because the previous glyphs | 10834 /* We may have skipped over point because the previous glyphs |
10819 are from string. As there's no easy way to know the | 10835 are from string. As there's no easy way to know the |
14611 if (PT == MATRIX_ROW_END_CHARPOS (row)) | 14627 if (PT == MATRIX_ROW_END_CHARPOS (row)) |
14612 { | 14628 { |
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) |
14623 cursor_row_p = 1; | 14651 cursor_row_p = 1; |
14624 else | 14652 else |
15090 /* Compute pixel dimensions of this line. */ | 15118 /* Compute pixel dimensions of this line. */ |
15091 compute_line_metrics (it); | 15119 compute_line_metrics (it); |
15092 | 15120 |
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; |
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); | |
15095 | 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; |
15099 row->right_user_fringe_bitmap = it->right_user_fringe_bitmap; | 15132 row->right_user_fringe_bitmap = it->right_user_fringe_bitmap; |