]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix eww-change-select defaults in a different way
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 6 Sep 2020 00:02:42 +0000 (02:02 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 6 Sep 2020 00:02:42 +0000 (02:02 +0200)
* lisp/net/eww.el (eww-change-select): Fix bug#43218 in a more
safe way than the previous version.

lisp/net/eww.el

index b800d1890fedb925f5f87ac0c36e9672fef5335e..4b897fa34e6d68bbebf37046762dad47987f2622 100644 (file)
@@ -1450,14 +1450,13 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
                               (cons (plist-get (cdr elem) :display)
                                     (plist-get (cdr elem) :value))))
                        input)))
-        (display
-         (completing-read "Change value: " options nil 'require-match
-                           nil nil (car (rassoc (plist-get input :value)
-                                                options))))
+        (display (completing-read "Change value: " options nil 'require-match))
         (inhibit-read-only t))
-    (plist-put input :value (cdr (assoc-string display options t)))
-    (goto-char
-     (eww-update-field display))))
+    ;; If the user doesn't enter anything, don't change anything.
+    (when (> (length display) 0)
+      (plist-put input :value (cdr (assoc-string display options t)))
+      (goto-char
+       (eww-update-field display)))))
 
 (defun eww-update-field (string &optional offset)
   (unless offset