From: Eli Zaretskii Date: Sun, 27 Jul 2014 18:05:37 +0000 (+0300) Subject: Support horizontal scrolling of bidirectional text. X-Git-Tag: emacs-25.0.90~2636^3~27 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0f6bbc3da36a77fbdd07e801fd1755702b157a6e;p=emacs.git Support horizontal scrolling of bidirectional text. lisp/scroll-bar.el (scroll-bar-toolkit-horizontal-scroll): Add rudimentary support for bidirectional text. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3f97396ca02..dd87a610057 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-27 Eli Zaretskii + + * scroll-bar.el (scroll-bar-toolkit-horizontal-scroll): Add + rudimentary support for bidirectional text. + 2014-07-27 Martin Rudalics * frame.el (frame-notice-user-settings): Rewrite using diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el index 09f30d5d3f0..739670cb1c9 100644 --- a/lisp/scroll-bar.el +++ b/lisp/scroll-bar.el @@ -451,6 +451,9 @@ EVENT should be a scroll bar click." (let* ((end-position (event-end event)) (window (nth 0 end-position)) (part (nth 4 end-position)) + (bidi-factor (if (eq (current-bidi-paragraph-direction) 'left-to-right) + 1 + -1)) before-scroll) (cond ((eq part 'end-scroll)) @@ -462,27 +465,32 @@ EVENT should be a scroll bar click." (setq before-scroll (or before-scroll (point))) (cond ((eq part 'before-handle) - (scroll-right 4)) + (scroll-right (* bidi-factor 4))) ((eq part 'after-handle) - (scroll-left 4)) + (scroll-left (* bidi-factor 4))) ((eq part 'ratio) (let* ((portion-whole (nth 2 end-position)) (columns (scroll-bar-scale portion-whole (1- (window-width))))) (scroll-right - (cond - ((not (zerop columns)) - columns) - ((< (car portion-whole) 0) -1) - (t 1))))) + (* (cond + ((not (zerop columns)) + columns) + ((< (car portion-whole) 0) -1) + (t 1)) + bidi-factor)))) ((eq part 'left) - (scroll-right 1)) + (scroll-right (* bidi-factor 1))) ((eq part 'right) - (scroll-left 1)) + (scroll-left (* bidi-factor 1))) ((eq part 'leftmost) - (goto-char (line-beginning-position))) + (goto-char (if (eq bidi-factor 1) + (line-beginning-position) + (line-end-position)))) ((eq part 'rightmost) - (goto-char (line-end-position))) + (goto-char (if (eq bidi-factor 1) + (line-end-position) + (line-beginning-position)))) ((eq part 'horizontal-handle) (scroll-bar-horizontal-drag-1 event)))) (sit-for 0)