From ef187c24a3a37e579c4c0c61a7ddefc59b17d5c5 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 6 Dec 2009 18:48:48 +0000 Subject: [PATCH] * simple.el (beginning-of-visual-line): Constrain to field boundaries (Bug#5106). --- lisp/ChangeLog | 5 +++++ lisp/simple.el | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 57d5b213bb9..c8b11dd1deb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-12-06 Chong Yidong + + * simple.el (beginning-of-visual-line): Constrain to field + boundaries (Bug#5106). + 2009-12-06 Ulf Jasper * xml.el (xml-substitute-numeric-entities): Moved diff --git a/lisp/simple.el b/lisp/simple.el index 65086dbfdfc..d1656b64919 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4576,6 +4576,8 @@ To ignore intangibility, bind `inhibit-point-motion-hooks' to t." (if (/= n 1) (let ((line-move-visual t)) (line-move (1- n) t))) + ;; Unlike `move-beginning-of-line', `move-end-of-line' doesn't + ;; constrain to field boundaries, so we don't either. (vertical-motion (cons (window-width) 0))) (defun beginning-of-visual-line (&optional n) @@ -4585,10 +4587,13 @@ If point reaches the beginning or end of buffer, it stops there. To ignore intangibility, bind `inhibit-point-motion-hooks' to t." (interactive "^p") (or n (setq n 1)) - (if (/= n 1) - (let ((line-move-visual t)) - (line-move (1- n) t))) - (vertical-motion 0)) + (let ((opoint (point))) + (if (/= n 1) + (let ((line-move-visual t)) + (line-move (1- n) t))) + (vertical-motion 0) + ;; Constrain to field boundaries, like `move-beginning-of-line'. + (goto-char (constrain-to-field (point) opoint (/= n 1))))) (defun kill-visual-line (&optional arg) "Kill the rest of the visual line. -- 2.39.5