changeset 33893:8b25bc5d3aa4

(widget-field-buffer, widget-field-start) (widget-field-end): Handle widget field `pseudo-overlays'. (widget-field-value-delete): Delete WIDGET from `widget-field-new' if it's there instead of in `widget-field-list'.
author Miles Bader <miles@gnu.org>
date Mon, 27 Nov 2000 09:48:31 +0000
parents 12f5fea864e1
children bec74894e41f
files lisp/wid-edit.el
diffstat 1 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/wid-edit.el	Mon Nov 27 02:31:34 2000 +0000
+++ b/lisp/wid-edit.el	Mon Nov 27 09:48:31 2000 +0000
@@ -1093,12 +1093,17 @@
 (defun widget-field-buffer (widget)
   "Return the start of WIDGET's editing field."
   (let ((overlay (widget-get widget :field-overlay)))
-    (and overlay (overlay-buffer overlay))))
+    (cond ((overlayp overlay)
+	   (overlay-buffer overlay))
+	  ((consp overlay)
+	   (marker-buffer (car overlay))))))
 
 (defun widget-field-start (widget)
   "Return the start of WIDGET's editing field."
   (let ((overlay (widget-get widget :field-overlay)))
-    (and overlay (overlay-start overlay))))
+    (if (overlayp overlay)
+	(overlay-start overlay)
+      (car overlay))))
 
 (defun widget-field-end (widget)
   "Return the end of WIDGET's editing field."
@@ -1106,15 +1111,16 @@
     ;; Don't subtract one if local-map works at the end of the overlay,
     ;; or if a special `boundary' field has been added after the widget
     ;; field.
-    (and overlay
-	 (if (and (not (eq (get-char-property (overlay-end overlay)
-					      'field
-					      (widget-field-buffer widget))
-			   'boundary))
-		  (or widget-field-add-space
-		      (null (widget-get widget :size))))
-	     (1- (overlay-end overlay))
-	   (overlay-end overlay)))))
+    (if (overlayp overlay)
+	(if (and (not (eq (get-char-property (overlay-end overlay)
+					     'field
+					     (widget-field-buffer widget))
+			  'boundary))
+		 (or widget-field-add-space
+		     (null (widget-get widget :size))))
+	    (1- (overlay-end overlay))
+	  (overlay-end overlay))
+      (cdr overlay))))
 
 (defun widget-field-find (pos)
   "Return the field at POS.
@@ -1745,6 +1751,7 @@
 (defun widget-field-value-delete (widget)
   "Remove the widget from the list of active editing fields."
   (setq widget-field-list (delq widget widget-field-list))
+  (setq widget-field-new (delq widget widget-field-new))
   ;; These are nil if the :format string doesn't contain `%v'.
   (let ((overlay (widget-get widget :field-overlay)))
     (when (overlayp overlay)