emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog simple.el


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp ChangeLog simple.el
Date: Sat, 25 Apr 2009 15:27:49 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/04/25 15:27:49

Modified files:
        lisp           : ChangeLog simple.el 

Log message:
        * simple.el (line-move-visual): If point is stuck moving backwards
        against a display string, temporarily ignore the goal
        column (Bug#3020).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15610&r2=1.15611
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/simple.el?cvsroot=emacs&r1=1.985&r2=1.986

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15610
retrieving revision 1.15611
diff -u -b -r1.15610 -r1.15611
--- ChangeLog   25 Apr 2009 14:25:06 -0000      1.15610
+++ ChangeLog   25 Apr 2009 15:27:45 -0000      1.15611
@@ -1,5 +1,9 @@
 2009-04-25  Chong Yidong  <address@hidden>
 
+       * simple.el (line-move-visual): If point is stuck moving backwards
+       against a display string, temporarily ignore the goal
+       column (Bug#3020).
+
        * startup.el (normal-top-level): Implement a work-around to handle
        changes to face-font-rescale-alist during
        initialization (Bug#1785).

Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.985
retrieving revision 1.986
diff -u -b -r1.985 -r1.986
--- simple.el   6 Apr 2009 15:45:04 -0000       1.985
+++ simple.el   25 Apr 2009 15:27:48 -0000      1.986
@@ -4056,24 +4056,31 @@
 ;; Arg says how many lines to move.  The value is t if we can move the
 ;; specified number of lines.
 (defun line-move-visual (arg &optional noerror)
-  (unless (and (floatp temporary-goal-column)
-              (or (memq last-command '(next-line previous-line))
-                  ;; In case we're called from some other command.
-                  (eq last-command this-command)))
     (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 (nth 2 posn)))
-            (setq temporary-goal-column (/ (float x) (frame-char-width)))))))
-  (or (= (vertical-motion
+           ((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)
+                ;; If the goal column lies on a display string,
+                ;; `vertical-motion' advances the cursor to the end
+                ;; of the string.  For arg < 0, this can cause the
+                ;; cursor to get stuck.  (Bug#3020).
+                (= (vertical-motion arg) arg)))
       (unless noerror
-       (signal (if (< arg 0)
-                   'beginning-of-buffer
-                 'end-of-buffer)
-               nil))))
+         (signal (if (< arg 0) 'beginning-of-buffer 'end-of-buffer)
+                 nil)))))
 
 ;; This is the guts of next-line and previous-line.
 ;; Arg says how many lines to move.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]