summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-01-08 16:04:46 +0200
committerEli Zaretskii <eliz@gnu.org>2015-01-08 16:04:46 +0200
commit5fbd17e369ca30a47ab8a2eda0b2f2ea9b690bb4 (patch)
tree253a55de82ec0ae74ed1d05004be77439da0231b /lisp/simple.el
parentad83cdacb6808377e2ef4f96e60ffb68dbf01cd9 (diff)
Fix line-move-visual's following of column in R2L lines.
src/simple.el (line-move-visual): When converting X pixel coordinate to temporary-goal-column, adjust the value for right-to-left screen lines. This fixes vertical-motion, next/prev-line, etc. src/dispnew.c (buffer_posn_from_coords): Fix the value of the column returned for right-to-left screen lines. (Before the change on 2014-12-30, the incorrectly-computed X pixel coordinate concealed this bug.)
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index e15291a345b..25293edf88f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5604,14 +5604,22 @@ If NOERROR, don't signal an error if we can't move that many lines."
(> (cdr temporary-goal-column) 0))
(setq target-hscroll (cdr temporary-goal-column)))
;; Otherwise, we should reset `temporary-goal-column'.
- (let ((posn (posn-at-point)))
+ (let ((posn (posn-at-point))
+ x-pos)
(cond
;; Handle the `overflow-newline-into-fringe' case:
((eq (nth 1 posn) 'right-fringe)
(setq temporary-goal-column (cons (- (window-width) 1) hscroll)))
((car (posn-x-y posn))
+ (setq x-pos (car (posn-x-y posn)))
+ ;; In R2L lines, the X pixel coordinate is measured from the
+ ;; left edge of the window, but columns are still counted
+ ;; from the logical-order beginning of the line, i.e. from
+ ;; the right edge in this case. We need to adjust for that.
+ (if (eq (current-bidi-paragraph-direction) 'right-to-left)
+ (setq x-pos (- (window-body-width nil t) 1 x-pos)))
(setq temporary-goal-column
- (cons (/ (float (car (posn-x-y posn)))
+ (cons (/ (float x-pos)
(frame-char-width))
hscroll))))))
(if target-hscroll