unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3494: 23.0.94; line-move-visual: temporary goal column confused by hscrolling
@ 2009-07-11 16:31 Chong Yidong
  2009-07-11 16:56 ` Teemu Likonen
  0 siblings, 1 reply; 12+ messages in thread
From: Chong Yidong @ 2009-07-11 16:31 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: 3494, Kees Bakker, Teemu Likonen

Please test this patch instead of the one I previously sent (I'll
install it on the trunk as well, for additional testing).

*** emacs/lisp/simple.el.~1.988.~	2009-06-21 00:37:46.000000000 -0400
--- emacs/lisp/simple.el	2009-07-11 12:30:05.000000000 -0400
***************
*** 3956,3965 ****
  (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
--- 3956,3969 ----
  (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
***************
*** 4059,4075 ****
    (let ((posn (posn-at-point))
  	(opoint (point))
  	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)
--- 4063,4095 ----
    (let ((posn (posn-at-point))
  	(opoint (point))
  	x)
!     ;; Check if the previous command was a line-motion command or we
!     ;; were called from some other command.
!     (cond ((and (consp temporary-goal-column)
! 		(memq last-command `(next-line previous-line ,this-command)))
! 	   ;; If so, there's no need to reset `temporary-goal-column',
! 	   ;; unless the window hscroll has changed.
! 	   (when (/= (window-hscroll) (cdr temporary-goal-column))
! 	     (set-window-hscroll nil 0)
! 	     (setq temporary-goal-column
! 		   (cons (+ (car temporary-goal-column)
! 			    (cdr temporary-goal-column)) 0))))
! 	  ;; Otherwise, we should reset `temporary-goal-column'.
! 	  ;; Handle the `overflow-newline-into-fringe' case:
! 	  ((eq (nth 1 posn) 'right-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)))
--- 4111,4119 ----
    (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)))





^ permalink raw reply	[flat|nested] 12+ messages in thread
* bug#3494: 23.0.94; line-move-visual: temporary goal column confused by hscrolling
@ 2009-07-11 16:03 Chong Yidong
  0 siblings, 0 replies; 12+ messages in thread
From: Chong Yidong @ 2009-07-11 16:03 UTC (permalink / raw)
  To: Johan Bockgård; +Cc: 3494, Kees Bakker, Teemu Likonen

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





^ permalink raw reply	[flat|nested] 12+ messages in thread
* bug#3494: 23.0.94; line-move-visual: temporary goal column confused by hscrolling
@ 2009-06-08  1:17 Johan =?UTF-8?Q?Bockg=C3=A5rd
  0 siblings, 0 replies; 12+ messages in thread
From: Johan =?UTF-8?Q?Bockg=C3=A5rd @ 2009-06-08  1:17 UTC (permalink / raw)
  To: emacs-pretest-bug

;; Text area is standard 80 columns
$ emacs -Q -f toggle-truncate-lines

C-u 85 a
RET
C-u 75 b
C-p C-n C-p

Point is now at the end of line "a".





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-07-12 16:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.2302.1247329057.2239.bug-gnu-emacs@gnu.org>
2009-07-11 16:44 ` bug#3494: 23.0.94; line-move-visual: temporary goal column confused by hscrolling Teemu Likonen
2009-07-11 17:25   ` Chong Yidong
2009-07-11 18:02     ` Teemu Likonen
2009-07-11 22:59       ` Chong Yidong
2009-07-12  7:05         ` Teemu Likonen
2009-07-12 16:04           ` Chong Yidong
2009-07-12 16:38             ` Lennart Borgman
2009-07-11 16:31 Chong Yidong
2009-07-11 16:56 ` Teemu Likonen
2009-07-11 17:23   ` Chong Yidong
  -- strict thread matches above, loose matches on Subject: below --
2009-07-11 16:03 Chong Yidong
2009-06-08  1:17 Johan =?UTF-8?Q?Bockg=C3=A5rd

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).