emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117707: Preliminary attempt to fix horizontal scrol


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r117707: Preliminary attempt to fix horizontal scroll bar dragging with bidi text.
Date: Sat, 16 Aug 2014 15:48:00 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117707
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Sat 2014-08-16 17:47:38 +0200
message:
  Preliminary attempt to fix horizontal scroll bar dragging with bidi text.
  
  * w32term.c (w32_horizontal_scroll_bar_handle_click): In y part
  of emacs_event return length from si.nPage to si.nMax.
  * xdisp.c (set_horizontal_scroll_bar): For right-to-left text
  interchange start and end of thumb.
  * scroll-bar.el (scroll-bar-horizontal-drag-1): Use cdr of
  portion-whole for scrolling right-to-left text.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/scroll-bar.el             
scrollbar.el-20091113204419-o5vbwnq5f7feedwu-535
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32term.c                  w32term.c-20091113204419-o5vbwnq5f7feedwu-950
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-08-15 04:34:06 +0000
+++ b/lisp/ChangeLog    2014-08-16 15:47:38 +0000
@@ -1,3 +1,8 @@
+2014-08-16  Martin Rudalics  <address@hidden>
+
+       * scroll-bar.el (scroll-bar-horizontal-drag-1): Use cdr of
+       portion-whole for scrolling right-to-left text.
+
 2014-08-15  Leo Liu  <address@hidden>
 
        * speedbar.el (speedbar-generic-list-tag-p): Allow special

=== modified file 'lisp/scroll-bar.el'
--- a/lisp/scroll-bar.el        2014-07-27 18:05:37 +0000
+++ b/lisp/scroll-bar.el        2014-08-16 15:47:38 +0000
@@ -327,8 +327,11 @@
         (window (nth 0 start-position))
         (portion-whole (nth 2 start-position))
         (unit (frame-char-width (window-frame window))))
-    (set-window-hscroll
-     window (/ (1- (+ (car portion-whole) unit)) unit))))
+    (if (eq (current-bidi-paragraph-direction) 'left-to-right)
+       (set-window-hscroll
+        window (/ (1- (+ (car portion-whole) unit)) unit))
+      (set-window-hscroll
+        window (/ (1- (+ (cdr portion-whole) unit)) unit)))))
 
 (defun scroll-bar-horizontal-drag (event)
   "Scroll the window horizontally by dragging the scroll bar slider.

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-08-15 04:34:06 +0000
+++ b/src/ChangeLog     2014-08-16 15:47:38 +0000
@@ -1,3 +1,10 @@
+2014-08-16  Martin Rudalics  <address@hidden>
+
+       * w32term.c (w32_horizontal_scroll_bar_handle_click): In y part
+       of emacs_event return length from si.nPage to si.nMax.
+       * xdisp.c (set_horizontal_scroll_bar): For right-to-left text
+       interchange start and end of thumb.
+
 2014-08-15  Ken Brown  <address@hidden>
 
        * gmalloc.c (_malloc_mutex, _aligned_blocks_mutex) [CYGWIN]: Use

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2014-08-05 08:25:28 +0000
+++ b/src/w32term.c     2014-08-16 15:47:38 +0000
@@ -4272,15 +4272,15 @@
 
   {
     int left_range = HORIZONTAL_SCROLL_BAR_LEFT_RANGE (f, bar->width);
-    int x;
+    int x, y;
     int dragging = bar->dragging;
     SCROLLINFO si;
 
     si.cbSize = sizeof (si);
-    si.fMask = SIF_POS;
-
+    si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE;
     GetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si);
     x = si.nPos;
+    y = si.nMax - si.nPos - si.nPage;
 
     bar->dragging = 0;
     FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam;
@@ -4354,7 +4354,7 @@
       }
 
     XSETINT (emacs_event->x, x);
-    XSETINT (emacs_event->y, left_range);
+    XSETINT (emacs_event->y, y);
 
     return TRUE;
   }

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2014-08-01 13:10:07 +0000
+++ b/src/xdisp.c       2014-08-16 15:47:38 +0000
@@ -15779,7 +15779,7 @@
 void
 set_horizontal_scroll_bar (struct window *w)
 {
-  int start, end, whole, box_width;
+  int start, end, whole, portion;
 
   if (!MINI_WINDOW_P (w)
       || (w == XWINDOW (minibuf_window)
@@ -15806,14 +15806,25 @@
                          MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); */
 
       start = w->hscroll * FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w));
-      box_width = window_box_width (w, TEXT_AREA);
-      end = start + box_width;
-
-      /* The following is needed to ensure that if after maximizing a
-        window we get hscroll > 0, we can still drag the thumb to the
-        left.  */
-      whole = max (whole, w->hscroll + box_width);
-      whole = max (whole, end - start);
+      end = start + window_box_width (w, TEXT_AREA);
+      portion = end - start;
+      /* After enlarging a horizontally scrolled window such that it
+        gets at least as wide as the text it contains, make sure that
+        the thumb doesn't fill the entire scroll bar so we can still
+        drag it back to see the entire text.  */
+      whole = max (whole, end);
+
+      if (it.bidi_p)
+       {
+         Lisp_Object pdir;
+
+         pdir = Fcurrent_bidi_paragraph_direction (Qnil);
+         if (EQ (pdir, Qright_to_left))
+           {
+             start = whole - end;
+             end = start + portion;
+           }
+       }
 
       if (old_buffer)
        set_buffer_internal (old_buffer);
@@ -15826,7 +15837,7 @@
   /* Indicate what this scroll bar ought to be displaying now.  */
   if (FRAME_TERMINAL (XFRAME (w->frame))->set_horizontal_scroll_bar_hook)
     (*FRAME_TERMINAL (XFRAME (w->frame))->set_horizontal_scroll_bar_hook)
-      (w, end - start, whole, start);
+      (w, portion, whole, start);
 }
 
 


reply via email to

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