diff options
| author | Eli Zaretskii | 2011-10-08 14:15:08 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2011-10-08 14:15:08 +0200 |
| commit | 03669ccbad9fcaf6c29003d23f3e8bdecaab21b1 (patch) | |
| tree | 8173951712ae907145a9079bfc7877c01e4c9e2c | |
| parent | 352ec8ffdd1ef4e5f335b921e0590ff746bebd5d (diff) | |
| download | emacs-03669ccbad9fcaf6c29003d23f3e8bdecaab21b1.tar.gz emacs-03669ccbad9fcaf6c29003d23f3e8bdecaab21b1.zip | |
src/xdisp.c (hscroll_window_tree): Support hscroll in right-to-left lines.
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 35 |
2 files changed, 32 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index edfecaa0930..3f93987c0f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-10-08 Eli Zaretskii <eliz@gnu.org> | 1 | 2011-10-08 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * xdisp.c (hscroll_window_tree): Support hscroll in right-to-left | ||
| 4 | lines. | ||
| 5 | |||
| 3 | * dispnew.c (buffer_posn_from_coords): Account for a possible | 6 | * dispnew.c (buffer_posn_from_coords): Account for a possible |
| 4 | presence of header-line. (Bug#4426) | 7 | presence of header-line. (Bug#4426) |
| 5 | 8 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index a072ff2c171..2fff6d9518c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -12065,6 +12065,7 @@ hscroll_window_tree (Lisp_Object window) | |||
| 12065 | = (desired_cursor_row->enabled_p | 12065 | = (desired_cursor_row->enabled_p |
| 12066 | ? desired_cursor_row | 12066 | ? desired_cursor_row |
| 12067 | : current_cursor_row); | 12067 | : current_cursor_row); |
| 12068 | int row_r2l_p = cursor_row->reversed_p; | ||
| 12068 | 12069 | ||
| 12069 | text_area_width = window_box_width (w, TEXT_AREA); | 12070 | text_area_width = window_box_width (w, TEXT_AREA); |
| 12070 | 12071 | ||
| @@ -12072,11 +12073,31 @@ hscroll_window_tree (Lisp_Object window) | |||
| 12072 | h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); | 12073 | h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); |
| 12073 | 12074 | ||
| 12074 | if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer)) | 12075 | if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer)) |
| 12075 | && ((XFASTINT (w->hscroll) | 12076 | /* For left-to-right rows, hscroll when cursor is either |
| 12076 | && w->cursor.x <= h_margin) | 12077 | (i) inside the right hscroll margin, or (ii) if it is |
| 12077 | || (cursor_row->enabled_p | 12078 | inside the left margin and the window is already |
| 12078 | && cursor_row->truncated_on_right_p | 12079 | hscrolled. */ |
| 12079 | && (w->cursor.x >= text_area_width - h_margin)))) | 12080 | && ((!row_r2l_p |
| 12081 | && ((XFASTINT (w->hscroll) | ||
| 12082 | && w->cursor.x <= h_margin) | ||
| 12083 | || (cursor_row->enabled_p | ||
| 12084 | && cursor_row->truncated_on_right_p | ||
| 12085 | && (w->cursor.x >= text_area_width - h_margin)))) | ||
| 12086 | /* For right-to-left rows, the logic is similar, | ||
| 12087 | except that rules for scrolling to left and right | ||
| 12088 | are reversed. E.g., if cursor.x <= h_margin, we | ||
| 12089 | need to hscroll "to the right" unconditionally, | ||
| 12090 | and that will scroll the screen to the left so as | ||
| 12091 | to reveal the next portion of the row. */ | ||
| 12092 | || (row_r2l_p | ||
| 12093 | && ((cursor_row->enabled_p | ||
| 12094 | /* FIXME: It is confusing to set the | ||
| 12095 | truncated_on_right_p flag when R2L rows | ||
| 12096 | are actually truncated on the left. */ | ||
| 12097 | && cursor_row->truncated_on_right_p | ||
| 12098 | && w->cursor.x <= h_margin) | ||
| 12099 | || (XFASTINT (w->hscroll) | ||
| 12100 | && (w->cursor.x >= text_area_width - h_margin)))))) | ||
| 12080 | { | 12101 | { |
| 12081 | struct it it; | 12102 | struct it it; |
| 12082 | int hscroll; | 12103 | int hscroll; |
| @@ -12111,7 +12132,9 @@ hscroll_window_tree (Lisp_Object window) | |||
| 12111 | ? (text_area_width - 4 * FRAME_COLUMN_WIDTH (it.f)) | 12132 | ? (text_area_width - 4 * FRAME_COLUMN_WIDTH (it.f)) |
| 12112 | : (text_area_width / 2)))) | 12133 | : (text_area_width / 2)))) |
| 12113 | / FRAME_COLUMN_WIDTH (it.f); | 12134 | / FRAME_COLUMN_WIDTH (it.f); |
| 12114 | else if (w->cursor.x >= text_area_width - h_margin) | 12135 | else if ((!row_r2l_p |
| 12136 | && w->cursor.x >= text_area_width - h_margin) | ||
| 12137 | || (row_r2l_p && w->cursor.x <= h_margin)) | ||
| 12115 | { | 12138 | { |
| 12116 | if (hscroll_relative_p) | 12139 | if (hscroll_relative_p) |
| 12117 | wanted_x = text_area_width * (1 - hscroll_step_rel) | 12140 | wanted_x = text_area_width * (1 - hscroll_step_rel) |