changeset 106459:44e685ee32cb

* simple.el (beginning-of-visual-line): Constrain to field boundaries (Bug#5106).
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 06 Dec 2009 18:48:48 +0000
parents 3b1d7962549d
children e341c53bc4af
files lisp/ChangeLog lisp/simple.el
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Dec 06 18:13:19 2009 +0000
+++ b/lisp/ChangeLog	Sun Dec 06 18:48:48 2009 +0000
@@ -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
--- a/lisp/simple.el	Sun Dec 06 18:13:19 2009 +0000
+++ b/lisp/simple.el	Sun Dec 06 18:48:48 2009 +0000
@@ -4576,6 +4576,8 @@
   (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 @@
 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.