aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2017-05-31 19:01:31 +0300
committerEli Zaretskii2017-05-31 19:01:31 +0300
commit140ddc321be96c03ef234a12c56cef97a078fc07 (patch)
tree96ea84c5cdcc8cfb9be7036bd30e702c62a736fb /src
parenta415c8bccb917c247792c4ce8e77b2512b3414d6 (diff)
downloademacs-140ddc321be96c03ef234a12c56cef97a078fc07.tar.gz
emacs-140ddc321be96c03ef234a12c56cef97a078fc07.zip
Support lower bound on hscrolling when only current line scrolls
* doc/emacs/display.texi (Horizontal Scrolling): Document the new mode of auto-hscrolling only the current line. * src/xdisp.c (init_iterator): When hscrolling only the current line, apply the window's min_hscroll here, so that non-current lines will be hscrolled by that minimum. Suggested by Stephen Berman <stephen.berman@gmx.net>. (hscroll_window_tree): Account for window's min_hscroll when deciding whether to recompute the hscroll. (display_line): Subtract window's min_hscroll from x_incr, as that was already accounted for in init_iterator. (Bug#27008)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index f4461c1627a..eaa701e9cf1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2890,8 +2890,19 @@ init_iterator (struct it *it, struct window *w,
2890 } 2890 }
2891 else 2891 else
2892 { 2892 {
2893 /* When hscrolling only the current line, don't apply the
2894 hscroll here, it will be applied by display_line when it gets
2895 to laying out the line showing point. However, if the
2896 window's min_hscroll is positive, the user specified a lower
2897 bound for automatic hscrolling, so they expect the
2898 non-current lines to obey that hscroll amount. */
2893 if (hscrolling_current_line_p (w)) 2899 if (hscrolling_current_line_p (w))
2894 it->first_visible_x = 0; 2900 {
2901 if (w->min_hscroll > 0)
2902 it->first_visible_x = w->min_hscroll * FRAME_COLUMN_WIDTH (it->f);
2903 else
2904 it->first_visible_x = 0;
2905 }
2895 else 2906 else
2896 it->first_visible_x = 2907 it->first_visible_x =
2897 window_hscroll_limited (w, it->f) * FRAME_COLUMN_WIDTH (it->f); 2908 window_hscroll_limited (w, it->f) * FRAME_COLUMN_WIDTH (it->f);
@@ -13099,7 +13110,9 @@ hscroll_window_tree (Lisp_Object window)
13099 that doesn't need to be hscrolled. If we omit 13110 that doesn't need to be hscrolled. If we omit
13100 this condition, the line from which we move will 13111 this condition, the line from which we move will
13101 remain hscrolled. */ 13112 remain hscrolled. */
13102 || (hscl && w->hscroll && !cursor_row->truncated_on_left_p))) 13113 || (hscl
13114 && w->hscroll != w->min_hscroll
13115 && !cursor_row->truncated_on_left_p)))
13103 { 13116 {
13104 struct it it; 13117 struct it it;
13105 ptrdiff_t hscroll; 13118 ptrdiff_t hscroll;
@@ -20717,9 +20730,12 @@ display_line (struct it *it, int cursor_vpos)
20717 recenter_overlay_lists (current_buffer, IT_CHARPOS (*it)); 20730 recenter_overlay_lists (current_buffer, IT_CHARPOS (*it));
20718 20731
20719 /* If we are going to display the cursor's line, account for the 20732 /* If we are going to display the cursor's line, account for the
20720 hscroll of that line. */ 20733 hscroll of that line. We subtract the window's min_hscroll,
20734 because that was already accounted for in init_iterator. */
20721 if (hscroll_this_line) 20735 if (hscroll_this_line)
20722 x_incr = window_hscroll_limited (it->w, it->f) * FRAME_COLUMN_WIDTH (it->f); 20736 x_incr =
20737 (window_hscroll_limited (it->w, it->f) - it->w->min_hscroll)
20738 * FRAME_COLUMN_WIDTH (it->f);
20723 20739
20724 /* Move over display elements that are not visible because we are 20740 /* Move over display elements that are not visible because we are
20725 hscrolled. This may stop at an x-position < first_visible_x 20741 hscrolled. This may stop at an x-position < first_visible_x