diff options
| author | Eli Zaretskii | 2015-01-08 16:04:46 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-01-09 11:06:18 +0200 |
| commit | 7c0bfa1d0803d824e3adaf9c6431997580771ef6 (patch) | |
| tree | fda2be0d3c305debeaba26f242830141d4444709 /lisp | |
| parent | 2a57b7e5b42175031efb8b4348638a05cb1c52a2 (diff) | |
| download | emacs-7c0bfa1d0803d824e3adaf9c6431997580771ef6.tar.gz emacs-7c0bfa1d0803d824e3adaf9c6431997580771ef6.zip | |
Fix line-move-visual's following of column in R2L lines (backport from trunk).
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.)
(cherry picked from commit 5fbd17e369ca30a47ab8a2eda0b2f2ea9b690bb4)
Conflicts:
lisp/simple.el
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/simple.el | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 73aa3e023b7..2a6c960c4be 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2015-01-08 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * simple.el (line-move-visual): When converting X pixel coordinate | ||
| 4 | to temporary-goal-column, adjust the value for right-to-left | ||
| 5 | screen lines. This fixes vertical-motion, next/prev-line, etc. | ||
| 6 | |||
| 1 | 2015-01-06 Glenn Morris <rgm@gnu.org> | 7 | 2015-01-06 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * progmodes/sh-script.el (sh-mode): Doc fix. | 9 | * progmodes/sh-script.el (sh-mode): Doc fix. |
diff --git a/lisp/simple.el b/lisp/simple.el index 0a1b6336f5f..497e4a1604f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -5254,15 +5254,24 @@ If NOERROR, don't signal an error if we can't move that many lines." | |||
| 5254 | (> (cdr temporary-goal-column) 0)) | 5254 | (> (cdr temporary-goal-column) 0)) |
| 5255 | (setq target-hscroll (cdr temporary-goal-column))) | 5255 | (setq target-hscroll (cdr temporary-goal-column))) |
| 5256 | ;; Otherwise, we should reset `temporary-goal-column'. | 5256 | ;; Otherwise, we should reset `temporary-goal-column'. |
| 5257 | (let ((posn (posn-at-point))) | 5257 | (let ((posn (posn-at-point)) |
| 5258 | x-pos) | ||
| 5258 | (cond | 5259 | (cond |
| 5259 | ;; Handle the `overflow-newline-into-fringe' case: | 5260 | ;; Handle the `overflow-newline-into-fringe' case: |
| 5260 | ((eq (nth 1 posn) 'right-fringe) | 5261 | ((eq (nth 1 posn) 'right-fringe) |
| 5261 | (setq temporary-goal-column (cons (- (window-width) 1) hscroll))) | 5262 | (setq temporary-goal-column (cons (- (window-width) 1) hscroll))) |
| 5262 | ((car (posn-x-y posn)) | 5263 | ((car (posn-x-y posn)) |
| 5264 | (setq x-pos (car (posn-x-y posn))) | ||
| 5265 | ;; In R2L lines, the X pixel coordinate is measured from the | ||
| 5266 | ;; left edge of the window, but columns are still counted | ||
| 5267 | ;; from the logical-order beginning of the line, i.e. from | ||
| 5268 | ;; the right edge in this case. We need to adjust for that. | ||
| 5269 | (if (eq (current-bidi-paragraph-direction) 'right-to-left) | ||
| 5270 | (setq x-pos (- (window-body-width nil t) 1 x-pos))) | ||
| 5263 | (setq temporary-goal-column | 5271 | (setq temporary-goal-column |
| 5264 | (cons (/ (float (car (posn-x-y posn))) | 5272 | (cons (/ (float x-pos) |
| 5265 | (frame-char-width)) hscroll)))))) | 5273 | (frame-char-width)) |
| 5274 | hscroll)))))) | ||
| 5266 | (if target-hscroll | 5275 | (if target-hscroll |
| 5267 | (set-window-hscroll (selected-window) target-hscroll)) | 5276 | (set-window-hscroll (selected-window) target-hscroll)) |
| 5268 | ;; vertical-motion can move more than it was asked to if it moves | 5277 | ;; vertical-motion can move more than it was asked to if it moves |