diff options
| author | Eli Zaretskii | 2017-07-20 16:25:11 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-07-20 16:25:11 +0300 |
| commit | 9c6cacd338c90180bc377cae923c716c1dc3d14c (patch) | |
| tree | 508f7c3541746c7c3f84f81f4756090443896ff6 /src | |
| parent | 371565f7d7746fe5682f4ddc3ab4ea820efccec7 (diff) | |
| download | emacs-9c6cacd338c90180bc377cae923c716c1dc3d14c.tar.gz emacs-9c6cacd338c90180bc377cae923c716c1dc3d14c.zip | |
Fix hscrolling calculations when display-line-numbers is set
* src/xdisp.c (move_it_in_display_line_to): Account for line
numbers in hscrolled lines. (Bug#27756)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index c415bf2131f..3e5657ffe6f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -8631,6 +8631,7 @@ move_it_in_display_line_to (struct it *it, | |||
| 8631 | ptrdiff_t closest_pos UNINIT; | 8631 | ptrdiff_t closest_pos UNINIT; |
| 8632 | ptrdiff_t prev_pos = IT_CHARPOS (*it); | 8632 | ptrdiff_t prev_pos = IT_CHARPOS (*it); |
| 8633 | bool saw_smaller_pos = prev_pos < to_charpos; | 8633 | bool saw_smaller_pos = prev_pos < to_charpos; |
| 8634 | bool line_number_pending = false; | ||
| 8634 | 8635 | ||
| 8635 | /* Don't produce glyphs in produce_glyphs. */ | 8636 | /* Don't produce glyphs in produce_glyphs. */ |
| 8636 | saved_glyph_row = it->glyph_row; | 8637 | saved_glyph_row = it->glyph_row; |
| @@ -8682,9 +8683,13 @@ move_it_in_display_line_to (struct it *it, | |||
| 8682 | if (it->hpos == 0) | 8683 | if (it->hpos == 0) |
| 8683 | { | 8684 | { |
| 8684 | /* If line numbers are being displayed, produce a line number. */ | 8685 | /* If line numbers are being displayed, produce a line number. */ |
| 8685 | if (should_produce_line_number (it) | 8686 | if (should_produce_line_number (it)) |
| 8686 | && it->current_x == it->first_visible_x) | 8687 | { |
| 8687 | maybe_produce_line_number (it); | 8688 | if (it->current_x == it->first_visible_x) |
| 8689 | maybe_produce_line_number (it); | ||
| 8690 | else | ||
| 8691 | line_number_pending = true; | ||
| 8692 | } | ||
| 8688 | /* If there's a line-/wrap-prefix, handle it. */ | 8693 | /* If there's a line-/wrap-prefix, handle it. */ |
| 8689 | if (it->method == GET_FROM_BUFFER) | 8694 | if (it->method == GET_FROM_BUFFER) |
| 8690 | handle_line_prefix (it); | 8695 | handle_line_prefix (it); |
| @@ -9055,6 +9060,15 @@ move_it_in_display_line_to (struct it *it, | |||
| 9055 | 9060 | ||
| 9056 | if (new_x > it->first_visible_x) | 9061 | if (new_x > it->first_visible_x) |
| 9057 | { | 9062 | { |
| 9063 | /* If we have reached the visible portion of the | ||
| 9064 | screen line, produce the line number if needed. */ | ||
| 9065 | if (line_number_pending) | ||
| 9066 | { | ||
| 9067 | line_number_pending = false; | ||
| 9068 | it->current_x = it->first_visible_x; | ||
| 9069 | maybe_produce_line_number (it); | ||
| 9070 | it->current_x += new_x - it->first_visible_x; | ||
| 9071 | } | ||
| 9058 | /* Glyph is visible. Increment number of glyphs that | 9072 | /* Glyph is visible. Increment number of glyphs that |
| 9059 | would be displayed. */ | 9073 | would be displayed. */ |
| 9060 | ++it->hpos; | 9074 | ++it->hpos; |