# HG changeset patch # User Miles Bader # Date 973256092 0 # Node ID eb486d535fd807e15042b44e321391e837ab0d79 # Parent 74b99e79dc029f3dfb74c2be86c2f10224c87cbb (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. diff -r 74b99e79dc02 -r eb486d535fd8 lisp/wid-edit.el --- 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."