changeset 33171:eb486d535fd8

(widget-end-of-line): Reinstate, with a new definition, so that trailing spaces are handled properly. (widget-field-keymap, widget-text-keymap): Likewise C-e binding.
author Miles Bader <miles@gnu.org>
date Fri, 03 Nov 2000 12:54:52 +0000
parents 74b99e79dc02
children 21be9a6e2988
files lisp/wid-edit.el
diffstat 1 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/wid-edit.el	Fri Nov 03 12:27:04 2000 +0000
+++ b/lisp/wid-edit.el	Fri Nov 03 12:54:52 2000 +0000
@@ -801,18 +801,18 @@
     (define-key map "\M-\t" 'widget-complete)
     (define-key map "\C-m" 'widget-field-activate)
     ;; Since the widget code uses a `field' property to identify fields,
-    ;; ordinary beginning-of-line/end-of-line do the right thing.
+    ;; ordinary beginning-of-line does the right thing.
     ;;  (define-key map "\C-a" 'widget-beginning-of-line)
-    ;;  (define-key map "\C-e" 'widget-end-of-line)
+    (define-key map "\C-e" 'widget-end-of-line)
     map)
   "Keymap used inside an editable field.")
 
 (defvar widget-text-keymap
   (let ((map (copy-keymap widget-keymap)))
     ;; Since the widget code uses a `field' property to identify fields,
-    ;; ordinary beginning-of-line/end-of-line do the right thing.
+    ;; ordinary beginning-of-line does the right thing.
     ;;  (define-key map "\C-a" 'widget-beginning-of-line)
-    ;;  (define-key map "\C-e" 'widget-end-of-line)
+    (define-key map "\C-e" 'widget-end-of-line)
     map)
   "Keymap used inside a text field.")
 
@@ -987,9 +987,22 @@
   (widget-move (- arg)))
 
 ;; Since the widget code uses a `field' property to identify fields,
-;; ordinary beginning-of-line/end-of-line do the right thing.
+;; ordinary beginning-of-line does the right thing.
 (defalias 'widget-beginning-of-line 'beginning-of-line)
-(defalias 'widget-end-of-line 'end-of-line)
+
+(defun widget-end-of-line ()
+  "Go to end of field or end of line, whichever is first.
+Trailing spaces at the end of padded fields are not considered part of
+the field."
+  (interactive)
+  ;; Ordinary end-of-line does the right thing, because we're inside
+  ;; text with a `field' property.
+  (end-of-line)
+  (unless (eolp)
+    ;; ... except that we want to ignore trailing spaces in fields that
+    ;; aren't terminated by a newline, because they are used as padding,
+    ;; and ignored when extracting the entered value of the field.
+    (skip-chars-backward " " (field-beginning (1- (point))))))
 
 (defun widget-kill-line ()
   "Kill to end of field or end of line, whichever is first."