summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-08-06 10:51:45 +0300
committerEli Zaretskii <eliz@gnu.org>2021-08-06 10:51:45 +0300
commit4d6511a2842ee92271b0ddc4572cb2a801a172a5 (patch)
tree420e51c7469c7540f7072568962236b96c83b906 /src
parentc327d61ec86023aaf6b014259db301f081a0e034 (diff)
downloademacs-4d6511a2842ee92271b0ddc4572cb2a801a172a5.tar.gz
Fix automatic hscrolling when line numbers are displayed
* src/xdisp.c (hscroll_window_tree): When line numbers are displayed, account for the the line-number space when calculating the desired X coordinate on the left. (Bug#49891)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 70d15aee68c..e62f7e3df6e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15082,11 +15082,12 @@ hscroll_window_tree (Lisp_Object window)
else
{
if (hscroll_relative_p)
- wanted_x = text_area_width * hscroll_step_rel
- + h_margin;
+ wanted_x =
+ text_area_width * hscroll_step_rel + h_margin + x_offset;
else
- wanted_x = hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f)
- + h_margin;
+ wanted_x =
+ hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f)
+ + h_margin + x_offset;
hscroll
= max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
}