GNU bug report logs - #3494
23.0.94; line-move-visual: temporary goal column confused by hscrolling

Previous Next

Package: emacs;

Reported by: bojohan+mail <at> dd.chalmers.se (Johan Bockgård)

Date: Mon, 8 Jun 2009 01:25:04 UTC

Severity: normal

Tags: fixed

Merged with 3805

Fixed in version 24.1

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #12 received at 3494 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Johan Bockgård  <bojohan <at> gnu.org>
Cc: kees <at> altium.nl (Kees Bakker), Teemu Likonen <tlikonen <at> iki.fi>,
        3494 <at> debbugs.gnu.org
Subject: Re: bug#3494: 23.0.94; line-move-visual: temporary goal column confused by hscrolling
Date: Sat, 11 Jul 2009 12:03:22 -0400
Does the following patch fix the problem?

diff -c /home/cyd/emacs/lisp/simple.el.\~1.988.\~ /home/cyd/emacs/lisp/simple.el
*** emacs/lisp/simple.el.~1.988.~	2009-06-21 00:37:46.000000000 -0400
--- emacs/lisp/simple.el	2009-07-11 11:58:55.000000000 -0400
***************
*** 3956,3966 ****
  (defvar temporary-goal-column 0
    "Current goal column for vertical motion.
  It is the column where point was at the start of the current run
! of vertical motion commands.  It is a floating point number when
! moving by visual lines via `line-move-visual'; this is the
! x-position, in pixels, divided by the default column width.  When
! the `track-eol' feature is doing its job, the value is
! `most-positive-fixnum'.")
  
  (defcustom line-move-ignore-invisible t
    "Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
--- 3956,3967 ----
  (defvar temporary-goal-column 0
    "Current goal column for vertical motion.
  It is the column where point was at the start of the current run
! of vertical motion commands.  When moving by visual lines via
! `line-move-visual', it is a cons cell (COL . HSCROLL), where COL
! is the x-position, in pixels, divided by the default column
! width, and HSCROLL is the number of columns by which window is
! scrolled from left margin.  When the `track-eol' feature is doing
! its job, the value is `most-positive-fixnum'.")
  
  (defcustom line-move-ignore-invisible t
    "Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
***************
*** 4061,4075 ****
  	x)
      ;; Reset temporary-goal-column, unless the previous command was a
      ;; line-motion command or we were called from some other command.
!     (unless (and (floatp temporary-goal-column)
! 		 (memq last-command `(next-line previous-line ,this-command)))
        (cond ((eq (nth 1 posn) 'right-fringe) ; overflow-newline-into-fringe
! 	     (setq temporary-goal-column (- (window-width) 1)))
  	    ((setq x (car (posn-x-y posn)))
! 	     (setq temporary-goal-column (/ (float x) (frame-char-width))))))
      ;; Move using `vertical-motion'.
      (or (and (= (vertical-motion
! 		 (cons (or goal-column (truncate temporary-goal-column)) arg))
  		arg)
  	     (or (>= arg 0)
  		 (/= (point) opoint)
--- 4062,4084 ----
  	x)
      ;; Reset temporary-goal-column, unless the previous command was a
      ;; line-motion command or we were called from some other command.
!     (if (and (consp temporary-goal-column)
! 	     (memq last-command `(next-line previous-line ,this-command)))
! 	;; Check window-hscroll
! 	(if (/= (window-hscroll) (cdr temporary-goal-column))
! 	    (set-window-hscroll nil (cdr temporary-goal-column)))
        (cond ((eq (nth 1 posn) 'right-fringe) ; overflow-newline-into-fringe
! 	     (setq temporary-goal-column
! 		   (cons (- (window-width) 1) (window-hscroll))))
  	    ((setq x (car (posn-x-y posn)))
! 	     (setq temporary-goal-column
! 		   (cons (/ (float x) (frame-char-width)) (window-hscroll))))))
      ;; Move using `vertical-motion'.
      (or (and (= (vertical-motion
! 		 (cons (or goal-column
! 			   (if (consp temporary-goal-column)
! 			       (truncate (car temporary-goal-column))
! 			     temporary-goal-column)) arg))
  		arg)
  	     (or (>= arg 0)
  		 (/= (point) opoint)
***************
*** 4091,4098 ****
    (let ((inhibit-point-motion-hooks t)
  	(opoint (point))
  	(orig-arg arg))
!     (if (floatp temporary-goal-column)
! 	(setq temporary-goal-column (truncate temporary-goal-column)))
      (unwind-protect
  	(progn
  	  (if (not (memq last-command '(next-line previous-line)))
--- 4100,4108 ----
    (let ((inhibit-point-motion-hooks t)
  	(opoint (point))
  	(orig-arg arg))
!     (if (consp temporary-goal-column)
! 	(setq temporary-goal-column (+ (car temporary-goal-column)
! 				       (cdr temporary-goal-column))))
      (unwind-protect
  	(progn
  	  (if (not (memq last-command '(next-line previous-line)))

Diff finished.  Sat Jul 11 11:58:57 2009



This bug report was last modified 13 years and 250 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.