summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2009-12-06 18:48:48 +0000
committerChong Yidong <cyd@stupidchicken.com>2009-12-06 18:48:48 +0000
commitef187c24a3a37e579c4c0c61a7ddefc59b17d5c5 (patch)
tree3e78e22e516ab36926bccfb2b65f280326bf7ed1
parent571855b6310390faa67d00bef0b0bc7aa118348f (diff)
downloademacs-ef187c24a3a37e579c4c0c61a7ddefc59b17d5c5.tar.gz
* simple.el (beginning-of-visual-line): Constrain to field
boundaries (Bug#5106).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/simple.el13
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 <cyd@stupidchicken.com>
+
+ * simple.el (beginning-of-visual-line): Constrain to field
+ boundaries (Bug#5106).
+
2009-12-06 Ulf Jasper <ulf.jasper@web.de>
* 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.