aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2023-11-16 11:22:58 +0200
committerEli Zaretskii2023-11-16 11:22:58 +0200
commit6733f45383bc1f57860d98803391cda076ed7cbb (patch)
treec91019dfe693e647f400b008b17516943dad72c8
parent4a2d39020c299332004bb2de1a698c18df40fe02 (diff)
downloademacs-6733f45383bc1f57860d98803391cda076ed7cbb.tar.gz
emacs-6733f45383bc1f57860d98803391cda076ed7cbb.zip
Fix scrolling when continuation line starts with a display string
* src/xdisp.c (start_display): Compute continuation_lines_width for starting display in strings and images as well. (Bug#67201)
-rw-r--r--src/xdisp.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 041c7adfc50..2dbe85f0f04 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3766,18 +3766,25 @@ start_display (struct it *it, struct window *w, struct text_pos pos)
3766 3766
3767 /* Don't reseat to previous visible line start if current start 3767 /* Don't reseat to previous visible line start if current start
3768 position is in a string or image. */ 3768 position is in a string or image. */
3769 if (it->method == GET_FROM_BUFFER && it->line_wrap != TRUNCATE) 3769 if (it->line_wrap != TRUNCATE)
3770 { 3770 {
3771 int first_y = it->current_y; 3771 enum it_method method = it->method;
3772 3772
3773 /* If window start is not at a line start, skip forward to POS to 3773 /* If window start is not at a line start, skip forward to POS
3774 get the correct continuation lines width. */ 3774 from the beginning of physical line to get the correct
3775 continuation lines width. */
3775 bool start_at_line_beg_p = (CHARPOS (pos) == BEGV 3776 bool start_at_line_beg_p = (CHARPOS (pos) == BEGV
3776 || FETCH_BYTE (BYTEPOS (pos) - 1) == '\n'); 3777 || FETCH_BYTE (BYTEPOS (pos) - 1) == '\n');
3777 if (!start_at_line_beg_p) 3778 if (!start_at_line_beg_p)
3778 { 3779 {
3780 int first_y = it->current_y;
3781 int continuation_width;
3782 void *itdata = NULL;
3783 struct it it2;
3779 int new_x; 3784 int new_x;
3780 3785
3786 if (method != GET_FROM_BUFFER)
3787 SAVE_IT (it2, *it, itdata);
3781 reseat_at_previous_visible_line_start (it); 3788 reseat_at_previous_visible_line_start (it);
3782 move_it_to (it, CHARPOS (pos), -1, -1, -1, MOVE_TO_POS); 3789 move_it_to (it, CHARPOS (pos), -1, -1, -1, MOVE_TO_POS);
3783 3790
@@ -3824,6 +3831,17 @@ start_display (struct it *it, struct window *w, struct text_pos pos)
3824 else if (it->current.dpvec_index >= 0) 3831 else if (it->current.dpvec_index >= 0)
3825 it->current.dpvec_index = 0; 3832 it->current.dpvec_index = 0;
3826 3833
3834 continuation_width = it->continuation_lines_width;
3835 /* If we started from a position in something other than a
3836 buffer, restore the original iterator state, keeping only
3837 the continuation_lines_width, since we could now be very
3838 far from the original position. */
3839 if (method != GET_FROM_BUFFER)
3840 {
3841 RESTORE_IT (it, &it2, itdata);
3842 it->continuation_lines_width = continuation_width;
3843 }
3844
3827 /* We're starting a new display line, not affected by the 3845 /* We're starting a new display line, not affected by the
3828 height of the continued line, so clear the appropriate 3846 height of the continued line, so clear the appropriate
3829 fields in the iterator structure. */ 3847 fields in the iterator structure. */