mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-27 07:37:33 +00:00
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)
This commit is contained in:
parent
a415c8bccb
commit
140ddc321b
@ -308,7 +308,11 @@ displayed. When the text in a window is scrolled horizontally, text
|
||||
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,
|
||||
@ -366,7 +370,10 @@ sufficiently large argument will restore the normal display.
|
||||
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
|
||||
|
1
etc/NEWS
1
etc/NEWS
@ -377,6 +377,7 @@ you may set this variable to nil. (Behind the scenes, there is now a
|
||||
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
|
||||
|
24
src/xdisp.c
24
src/xdisp.c
@ -2890,8 +2890,19 @@ init_iterator (struct it *it, struct window *w,
|
||||
}
|
||||
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);
|
||||
@ -13099,7 +13110,9 @@ hscroll_window_tree (Lisp_Object window)
|
||||
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;
|
||||
@ -20717,9 +20730,12 @@ display_line (struct it *it, int cursor_vpos)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user