diff options
| author | Eli Zaretskii | 2014-07-27 21:05:37 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-07-27 21:05:37 +0300 |
| commit | 0f6bbc3da36a77fbdd07e801fd1755702b157a6e (patch) | |
| tree | d44bc19ee5b15cd66acb14e37ac5024315cfa231 | |
| parent | 96fa02baec9bab4ed7610970ab1058051312f584 (diff) | |
| download | emacs-0f6bbc3da36a77fbdd07e801fd1755702b157a6e.tar.gz emacs-0f6bbc3da36a77fbdd07e801fd1755702b157a6e.zip | |
Support horizontal scrolling of bidirectional text.
lisp/scroll-bar.el (scroll-bar-toolkit-horizontal-scroll): Add
rudimentary support for bidirectional text.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/scroll-bar.el | 30 |
2 files changed, 24 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3f97396ca02..dd87a610057 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-07-27 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * scroll-bar.el (scroll-bar-toolkit-horizontal-scroll): Add | ||
| 4 | rudimentary support for bidirectional text. | ||
| 5 | |||
| 1 | 2014-07-27 Martin Rudalics <rudalics@gmx.at> | 6 | 2014-07-27 Martin Rudalics <rudalics@gmx.at> |
| 2 | 7 | ||
| 3 | * frame.el (frame-notice-user-settings): Rewrite using | 8 | * 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." | |||
| 451 | (let* ((end-position (event-end event)) | 451 | (let* ((end-position (event-end event)) |
| 452 | (window (nth 0 end-position)) | 452 | (window (nth 0 end-position)) |
| 453 | (part (nth 4 end-position)) | 453 | (part (nth 4 end-position)) |
| 454 | (bidi-factor (if (eq (current-bidi-paragraph-direction) 'left-to-right) | ||
| 455 | 1 | ||
| 456 | -1)) | ||
| 454 | before-scroll) | 457 | before-scroll) |
| 455 | (cond | 458 | (cond |
| 456 | ((eq part 'end-scroll)) | 459 | ((eq part 'end-scroll)) |
| @@ -462,27 +465,32 @@ EVENT should be a scroll bar click." | |||
| 462 | (setq before-scroll (or before-scroll (point))) | 465 | (setq before-scroll (or before-scroll (point))) |
| 463 | (cond | 466 | (cond |
| 464 | ((eq part 'before-handle) | 467 | ((eq part 'before-handle) |
| 465 | (scroll-right 4)) | 468 | (scroll-right (* bidi-factor 4))) |
| 466 | ((eq part 'after-handle) | 469 | ((eq part 'after-handle) |
| 467 | (scroll-left 4)) | 470 | (scroll-left (* bidi-factor 4))) |
| 468 | ((eq part 'ratio) | 471 | ((eq part 'ratio) |
| 469 | (let* ((portion-whole (nth 2 end-position)) | 472 | (let* ((portion-whole (nth 2 end-position)) |
| 470 | (columns (scroll-bar-scale portion-whole | 473 | (columns (scroll-bar-scale portion-whole |
| 471 | (1- (window-width))))) | 474 | (1- (window-width))))) |
| 472 | (scroll-right | 475 | (scroll-right |
| 473 | (cond | 476 | (* (cond |
| 474 | ((not (zerop columns)) | 477 | ((not (zerop columns)) |
| 475 | columns) | 478 | columns) |
| 476 | ((< (car portion-whole) 0) -1) | 479 | ((< (car portion-whole) 0) -1) |
| 477 | (t 1))))) | 480 | (t 1)) |
| 481 | bidi-factor)))) | ||
| 478 | ((eq part 'left) | 482 | ((eq part 'left) |
| 479 | (scroll-right 1)) | 483 | (scroll-right (* bidi-factor 1))) |
| 480 | ((eq part 'right) | 484 | ((eq part 'right) |
| 481 | (scroll-left 1)) | 485 | (scroll-left (* bidi-factor 1))) |
| 482 | ((eq part 'leftmost) | 486 | ((eq part 'leftmost) |
| 483 | (goto-char (line-beginning-position))) | 487 | (goto-char (if (eq bidi-factor 1) |
| 488 | (line-beginning-position) | ||
| 489 | (line-end-position)))) | ||
| 484 | ((eq part 'rightmost) | 490 | ((eq part 'rightmost) |
| 485 | (goto-char (line-end-position))) | 491 | (goto-char (if (eq bidi-factor 1) |
| 492 | (line-end-position) | ||
| 493 | (line-beginning-position)))) | ||
| 486 | ((eq part 'horizontal-handle) | 494 | ((eq part 'horizontal-handle) |
| 487 | (scroll-bar-horizontal-drag-1 event)))) | 495 | (scroll-bar-horizontal-drag-1 event)))) |
| 488 | (sit-for 0) | 496 | (sit-for 0) |