lines are truncated rather than continued (@pxref{Line Truncation}).
If a window shows truncated lines, Emacs performs automatic horizontal
scrolling whenever point moves off the left or right edge of the
-screen. To disable automatic horizontal scrolling, set the variable
+screen. By default, all the lines in the window are scrolled
+horizontally together, but if you set the variable
+@code{auto-hscroll-mode} to the special value of @code{current-line},
+only the line showing the cursor will be scrolled. To disable
+automatic horizontal scrolling entirely, set the variable
@code{auto-hscroll-mode} to @code{nil}. Note that when the automatic
horizontal scrolling is turned off, if point moves off the edge of the
screen, the cursor disappears to indicate that. (On text terminals,
If you use those commands to scroll a window horizontally, that sets
a lower bound for automatic horizontal scrolling. Automatic scrolling
will continue to scroll the window, but never farther to the right
-than the amount you previously set by @code{scroll-left}.
+than the amount you previously set by @code{scroll-left}. When
+@code{auto-hscroll-mode} is set to @code{current-line}, all the lines
+other than the one showing the cursor will be scrolled by that minimal
+amount.
@node Narrowing
@section Narrowing
new mode line construct, '%C', which operates exactly as '%c' does
except that it counts from one.)
++++
** New single-line horizontal scrolling mode.
The 'auto-hscroll-mode' variable can now have a new special value,
'current-line', which causes only the line where the cursor is
}
else
{
+ /* When hscrolling only the current line, don't apply the
+ hscroll here, it will be applied by display_line when it gets
+ to laying out the line showing point. However, if the
+ window's min_hscroll is positive, the user specified a lower
+ bound for automatic hscrolling, so they expect the
+ non-current lines to obey that hscroll amount. */
if (hscrolling_current_line_p (w))
- it->first_visible_x = 0;
+ {
+ if (w->min_hscroll > 0)
+ it->first_visible_x = w->min_hscroll * FRAME_COLUMN_WIDTH (it->f);
+ else
+ it->first_visible_x = 0;
+ }
else
it->first_visible_x =
window_hscroll_limited (w, it->f) * FRAME_COLUMN_WIDTH (it->f);
that doesn't need to be hscrolled. If we omit
this condition, the line from which we move will
remain hscrolled. */
- || (hscl && w->hscroll && !cursor_row->truncated_on_left_p)))
+ || (hscl
+ && w->hscroll != w->min_hscroll
+ && !cursor_row->truncated_on_left_p)))
{
struct it it;
ptrdiff_t hscroll;
recenter_overlay_lists (current_buffer, IT_CHARPOS (*it));
/* If we are going to display the cursor's line, account for the
- hscroll of that line. */
+ hscroll of that line. We subtract the window's min_hscroll,
+ because that was already accounted for in init_iterator. */
if (hscroll_this_line)
- x_incr = window_hscroll_limited (it->w, it->f) * FRAME_COLUMN_WIDTH (it->f);
+ x_incr =
+ (window_hscroll_limited (it->w, it->f) - it->w->min_hscroll)
+ * FRAME_COLUMN_WIDTH (it->f);
/* Move over display elements that are not visible because we are
hscrolled. This may stop at an x-position < first_visible_x