Commit 03669ccb authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

src/xdisp.c (hscroll_window_tree): Support hscroll in right-to-left lines.

parent 352ec8ff
2011-10-08 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (hscroll_window_tree): Support hscroll in right-to-left
lines.
* dispnew.c (buffer_posn_from_coords): Account for a possible
presence of header-line. (Bug#4426)
......
......@@ -12065,6 +12065,7 @@ hscroll_window_tree (Lisp_Object window)
= (desired_cursor_row->enabled_p
? desired_cursor_row
: current_cursor_row);
int row_r2l_p = cursor_row->reversed_p;
text_area_width = window_box_width (w, TEXT_AREA);
......@@ -12072,11 +12073,31 @@ hscroll_window_tree (Lisp_Object window)
h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w);
if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer))
&& ((XFASTINT (w->hscroll)
&& w->cursor.x <= h_margin)
|| (cursor_row->enabled_p
&& cursor_row->truncated_on_right_p
&& (w->cursor.x >= text_area_width - h_margin))))
/* For left-to-right rows, hscroll when cursor is either
(i) inside the right hscroll margin, or (ii) if it is
inside the left margin and the window is already
hscrolled. */
&& ((!row_r2l_p
&& ((XFASTINT (w->hscroll)
&& w->cursor.x <= h_margin)
|| (cursor_row->enabled_p
&& cursor_row->truncated_on_right_p
&& (w->cursor.x >= text_area_width - h_margin))))
/* For right-to-left rows, the logic is similar,
except that rules for scrolling to left and right
are reversed. E.g., if cursor.x <= h_margin, we
need to hscroll "to the right" unconditionally,
and that will scroll the screen to the left so as
to reveal the next portion of the row. */
|| (row_r2l_p
&& ((cursor_row->enabled_p
/* FIXME: It is confusing to set the
truncated_on_right_p flag when R2L rows
are actually truncated on the left. */
&& cursor_row->truncated_on_right_p
&& w->cursor.x <= h_margin)
|| (XFASTINT (w->hscroll)
&& (w->cursor.x >= text_area_width - h_margin))))))
{
struct it it;
int hscroll;
......@@ -12111,7 +12132,9 @@ hscroll_window_tree (Lisp_Object window)
? (text_area_width - 4 * FRAME_COLUMN_WIDTH (it.f))
: (text_area_width / 2))))
/ FRAME_COLUMN_WIDTH (it.f);
else if (w->cursor.x >= text_area_width - h_margin)
else if ((!row_r2l_p
&& w->cursor.x >= text_area_width - h_margin)
|| (row_r2l_p && w->cursor.x <= h_margin))
{
if (hscroll_relative_p)
wanted_x = text_area_width * (1 - hscroll_step_rel)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment