When the `track-eol' feature is doing its job, the value is
`most-positive-fixnum'.")
-(defvar last--line-number-width 0
- "Last value of width used for displaying line numbers.
-Used internally by `line-move-visual'.")
-
(defcustom line-move-ignore-invisible t
"Non-nil means commands that move by lines ignore invisible newlines.
When this option is non-nil, \\[next-line], \\[previous-line], \\[move-end-of-line], and \\[move-beginning-of-line] behave
(memq last-command `(next-line previous-line ,this-command)))
;; If so, there's no need to reset `temporary-goal-column',
;; but we may need to hscroll.
- (progn
- (if (or (/= (cdr temporary-goal-column) hscroll)
- (> (cdr temporary-goal-column) 0))
- (setq target-hscroll (cdr temporary-goal-column)))
- ;; Update the COLUMN part of temporary-goal-column if the
- ;; line-number display changed its width since the last
- ;; time.
- (setq temporary-goal-column
- (cons (+ (car temporary-goal-column)
- (/ (float (- lnum-width last--line-number-width))
- (frame-char-width)))
- (cdr temporary-goal-column)))
- (setq last--line-number-width lnum-width))
+ (if (or (/= (cdr temporary-goal-column) hscroll)
+ (> (cdr temporary-goal-column) 0))
+ (setq target-hscroll (cdr temporary-goal-column)))
;; Otherwise, we should reset `temporary-goal-column'.
(let ((posn (posn-at-point))
x-pos)
((memq (nth 1 posn) '(right-fringe left-fringe))
(setq temporary-goal-column (cons (window-width) hscroll)))
((car (posn-x-y posn))
- (setq x-pos (car (posn-x-y posn)))
+ (setq x-pos (- (car (posn-x-y posn)) lnum-width))
;; 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
overshoot_handled = 1;
}
if (lcols_given)
- to_x = window_column_x (w, window, extract_float (lcols), lcols);
+ to_x =
+ window_column_x (w, window, extract_float (lcols), lcols)
+ + lnum_pixel_width;
if (nlines <= 0)
{
it.vpos = vpos_init;
an addition to the hscroll amount. */
if (lcols_given)
{
- /* If we are displaying line numbers, we could cross the
- line where the width of the line-number display changes,
- in which case we need to fix up the pixel coordinate
- accordingly. */
- if (lnum_pixel_width > 0)
- to_x += it.lnum_pixel_width - lnum_pixel_width;
move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X);
/* If we find ourselves in the middle of an overlay string
which includes a newline after current string position,