[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 9c6cacd: Fix hscrolling calculations when display-l
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 9c6cacd: Fix hscrolling calculations when display-line-numbers is set |
Date: |
Thu, 20 Jul 2017 09:26:31 -0400 (EDT) |
branch: master
commit 9c6cacd338c90180bc377cae923c716c1dc3d14c
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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)
---
src/xdisp.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index c415bf2..3e5657f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8631,6 +8631,7 @@ move_it_in_display_line_to (struct it *it,
ptrdiff_t closest_pos UNINIT;
ptrdiff_t prev_pos = IT_CHARPOS (*it);
bool saw_smaller_pos = prev_pos < to_charpos;
+ bool line_number_pending = false;
/* Don't produce glyphs in produce_glyphs. */
saved_glyph_row = it->glyph_row;
@@ -8682,9 +8683,13 @@ move_it_in_display_line_to (struct it *it,
if (it->hpos == 0)
{
/* If line numbers are being displayed, produce a line number. */
- if (should_produce_line_number (it)
- && it->current_x == it->first_visible_x)
- maybe_produce_line_number (it);
+ if (should_produce_line_number (it))
+ {
+ if (it->current_x == it->first_visible_x)
+ maybe_produce_line_number (it);
+ else
+ line_number_pending = true;
+ }
/* If there's a line-/wrap-prefix, handle it. */
if (it->method == GET_FROM_BUFFER)
handle_line_prefix (it);
@@ -9055,6 +9060,15 @@ move_it_in_display_line_to (struct it *it,
if (new_x > it->first_visible_x)
{
+ /* If we have reached the visible portion of the
+ screen line, produce the line number if needed. */
+ if (line_number_pending)
+ {
+ line_number_pending = false;
+ it->current_x = it->first_visible_x;
+ maybe_produce_line_number (it);
+ it->current_x += new_x - it->first_visible_x;
+ }
/* Glyph is visible. Increment number of glyphs that
would be displayed. */
++it->hpos;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 9c6cacd: Fix hscrolling calculations when display-line-numbers is set,
Eli Zaretskii <=