aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/simple.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 1db14a859d6..3d23fc35596 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5942,6 +5942,10 @@ columns by which window is scrolled from left margin.
5942When the `track-eol' feature is doing its job, the value is 5942When the `track-eol' feature is doing its job, the value is
5943`most-positive-fixnum'.") 5943`most-positive-fixnum'.")
5944 5944
5945(defvar last--line-number-width 0
5946 "Last value of width used for displaying line numbers.
5947Used internally by `line-move-visual'.")
5948
5945(defcustom line-move-ignore-invisible t 5949(defcustom line-move-ignore-invisible t
5946 "Non-nil means commands that move by lines ignore invisible newlines. 5950 "Non-nil means commands that move by lines ignore invisible newlines.
5947When this option is non-nil, \\[next-line], \\[previous-line], \\[move-end-of-line], and \\[move-beginning-of-line] behave 5951When this option is non-nil, \\[next-line], \\[previous-line], \\[move-end-of-line], and \\[move-beginning-of-line] behave
@@ -6212,6 +6216,7 @@ not vscroll."
6212If NOERROR, don't signal an error if we can't move that many lines." 6216If NOERROR, don't signal an error if we can't move that many lines."
6213 (let ((opoint (point)) 6217 (let ((opoint (point))
6214 (hscroll (window-hscroll)) 6218 (hscroll (window-hscroll))
6219 (lnum-width (line-number-display-width t))
6215 target-hscroll) 6220 target-hscroll)
6216 ;; Check if the previous command was a line-motion command, or if 6221 ;; Check if the previous command was a line-motion command, or if
6217 ;; we were called from some other command. 6222 ;; we were called from some other command.
@@ -6219,9 +6224,19 @@ If NOERROR, don't signal an error if we can't move that many lines."
6219 (memq last-command `(next-line previous-line ,this-command))) 6224 (memq last-command `(next-line previous-line ,this-command)))
6220 ;; If so, there's no need to reset `temporary-goal-column', 6225 ;; If so, there's no need to reset `temporary-goal-column',
6221 ;; but we may need to hscroll. 6226 ;; but we may need to hscroll.
6222 (if (or (/= (cdr temporary-goal-column) hscroll) 6227 (progn
6223 (> (cdr temporary-goal-column) 0)) 6228 (if (or (/= (cdr temporary-goal-column) hscroll)
6224 (setq target-hscroll (cdr temporary-goal-column))) 6229 (> (cdr temporary-goal-column) 0))
6230 (setq target-hscroll (cdr temporary-goal-column)))
6231 ;; Update the COLUMN part of temporary-goal-column if the
6232 ;; line-number display changed its width since the last
6233 ;; time.
6234 (setq temporary-goal-column
6235 (cons (+ (car temporary-goal-column)
6236 (/ (float (- lnum-width last--line-number-width))
6237 (frame-char-width)))
6238 (cdr temporary-goal-column)))
6239 (setq last--line-number-width lnum-width))
6225 ;; Otherwise, we should reset `temporary-goal-column'. 6240 ;; Otherwise, we should reset `temporary-goal-column'.
6226 (let ((posn (posn-at-point)) 6241 (let ((posn (posn-at-point))
6227 x-pos) 6242 x-pos)