changeset 22941:b00170a05570

(widget-beginning-of-line): Properly handle multiline fields. Don't use call-interactively. (widget-end-of-line): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Sat, 08 Aug 1998 02:34:05 +0000
parents 3cfe86230c87
children 39f23890e482
files lisp/wid-edit.el
diffstat 1 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/wid-edit.el	Sat Aug 08 01:03:27 1998 +0000
+++ b/lisp/wid-edit.el	Sat Aug 08 02:34:05 1998 +0000
@@ -1111,19 +1111,25 @@
   "Go to beginning of field or beginning of line, whichever is first."
   (interactive)
   (let* ((field (widget-field-find (point)))
-	 (start (and field (widget-field-start field))))
-    (if (and start (not (eq start (point))))
-	(goto-char start)
-      (call-interactively 'beginning-of-line))))
+	 (start (and field (widget-field-start field)))
+         (bol (save-excursion
+                (beginning-of-line)
+                (point))))
+    (goto-char (if start
+                   (max start bol)
+                 bol))))
 
 (defun widget-end-of-line ()
   "Go to end of field or end of line, whichever is first."
   (interactive)
   (let* ((field (widget-field-find (point)))
-	 (end (and field (widget-field-end field))))
-    (if (and end (not (eq end (point))))
-	(goto-char end)
-      (call-interactively 'end-of-line))))
+	 (end (and field (widget-field-end field)))
+         (eol (save-excursion
+                (end-of-line)
+                (point))))
+    (goto-char (if end
+                   (min end eol)
+                 eol))))
 
 (defun widget-kill-line ()
   "Kill to end of field or end of line, whichever is first."