emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106023: src/xdisp.c (hscroll_window_


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106023: src/xdisp.c (hscroll_window_tree): Support hscroll in right-to-left lines.
Date: Sat, 08 Oct 2011 14:15:08 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106023
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2011-10-08 14:15:08 +0200
message:
  src/xdisp.c (hscroll_window_tree): Support hscroll in right-to-left lines.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-10-08 10:58:50 +0000
+++ b/src/ChangeLog     2011-10-08 12:15:08 +0000
@@ -1,5 +1,8 @@
 2011-10-08  Eli Zaretskii  <address@hidden>
 
+       * 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)
 

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-09-28 14:37:27 +0000
+++ b/src/xdisp.c       2011-10-08 12:15:08 +0000
@@ -12065,6 +12065,7 @@
            = (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 @@
          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 @@
                                      ? (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]