From 2d33a9ca0b408806c4b929c001d9b917244f6d22 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 25 Dec 2015 06:47:28 +0100 Subject: [PATCH] Make toggling checkboxes work again * eww.el (eww-update-field): Make toggling checkboxes work again (bug#21881). Backport: (cherry picked from commit 5e56f606952e5e81b4d3a93ea70e791b74b33041) --- lisp/net/eww.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index a22664bfbb5..5bcb6221cbb 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1177,16 +1177,19 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") (eww-update-field display)))) (defun eww-update-field (string &optional offset) - (if (not offset) (setq offset 0)) + (unless offset + (setq offset 0)) (let ((properties (text-properties-at (point))) (start (+ (eww-beginning-of-field) offset)) (current-end (1+ (eww-end-of-field))) - (new-end (1+ (+ (eww-beginning-of-field) (length string))))) + (new-end (+ (eww-beginning-of-field) (length string))) + (inhibit-read-only t)) (delete-region start current-end) (forward-char offset) (insert string (make-string (- (- (+ new-end offset) start) (length string)) ? )) - (if (= 0 offset) (set-text-properties start new-end properties)) + (when (= 0 offset) + (set-text-properties start new-end properties)) start)) (defun eww-toggle-checkbox () -- 2.39.2