From fef11f1549c7eb79892c09b096d8edb11656c9ae Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 19 Sep 2006 21:34:01 +0000 Subject: [PATCH] * simple.el (line-move-1): Escape field boundaries occurring exactly at point. Update goal column if constrained to a field. (line-move-finish): Escape field boundaries occurring exactly at point. --- lisp/ChangeLog | 7 +++++++ lisp/simple.el | 25 +++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e1272eae91e..977660407b8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2006-09-19 Chong Yidong + + * simple.el (line-move-1): Escape field boundaries occurring + exactly at point. Update goal column if constrained to a field. + (line-move-finish): Escape field boundaries occurring exactly at + point. + 2006-09-19 Stefan Monnier * mouse.el (mouse-on-link-p): Tentatively fix last change. diff --git a/lisp/simple.el b/lisp/simple.el index 5a30471ca49..8f954c281a1 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3561,7 +3561,7 @@ Outline mode sets this." ;; for intermediate positions. (let ((inhibit-point-motion-hooks t) (opoint (point)) - (forward (> arg 0))) + (orig-arg arg)) (unwind-protect (progn (if (not (memq last-command '(next-line previous-line))) @@ -3594,14 +3594,27 @@ Outline mode sets this." 'end-of-buffer) nil))) ;; Move by arg lines, but ignore invisible ones. - (let (done) + (let (done line-end) (while (and (> arg 0) (not done)) ;; If the following character is currently invisible, ;; skip all characters with that same `invisible' property value. (while (and (not (eobp)) (line-move-invisible-p (point))) (goto-char (next-char-property-change (point)))) - ;; Now move a line. - (end-of-line) + ;; Move a line. + ;; We don't use `end-of-line', since we want to escape + ;; from field boundaries ocurring exactly at point. + (let ((inhibit-field-text-motion t)) + (setq line-end (line-end-position))) + (goto-char (constrain-to-field line-end (point) t t)) + ;; When moving a single line, update the goal-column + ;; if we couldn't move to the end of line due to a + ;; field boundary. Otherwise we'll get stuck at the + ;; original position during the column motion in + ;; line-move-finish. + (and (/= line-end (point)) + (= orig-arg 1) + (setq temporary-goal-column + (max temporary-goal-column (current-column)))) ;; If there's no invisibility here, move over the newline. (cond ((eobp) @@ -3659,7 +3672,7 @@ Outline mode sets this." (beginning-of-line)) (t (line-move-finish (or goal-column temporary-goal-column) - opoint forward)))))) + opoint (> orig-arg 0))))))) (defun line-move-finish (column opoint forward) (let ((repeat t)) @@ -3721,7 +3734,7 @@ Outline mode sets this." (goto-char opoint) (let ((inhibit-point-motion-hooks nil)) (goto-char - (constrain-to-field new opoint nil t + (constrain-to-field new opoint t t 'inhibit-line-move-field-capture))) ;; If all this moved us to a different line, -- 2.39.2