From a5b07aa6b55b4158bf51457e4cb8649d48423a4d Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Thu, 27 Nov 2014 17:19:52 +0100 Subject: [PATCH] eww input field fixup Fixes: debbugs:19085 (eww-process-text-input): Don't shorten the input field if deleting at the last character. --- lisp/ChangeLog | 2 ++ lisp/net/eww.el | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b0b1d747746..50c8e402f0c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * net/eww.el (eww): Record the new URL immediately, so that if the HTTP fetch fails, we have the right URL in the buffer. + (eww-process-text-input): Don't shorten the input field if + deleting at the last character (bug#19085). * dom.el (dom-pp): New function. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index a8c910945b6..23f3653f362 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -953,9 +953,9 @@ appears in a or tag." See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") (defun eww-process-text-input (beg end length) - (let* ((form (get-text-property (min (1+ end) (point-max)) 'eww-form)) + (let* ((form (get-text-property (min (1- end) (point-max)) 'eww-form)) (inhibit-read-only t) - (properties (text-properties-at end)) + (properties (text-properties-at (1- end))) (type (plist-get form :type))) (when (and form (member type eww-text-input-types)) @@ -976,10 +976,11 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") ((> length 0) ;; Add padding. (save-excursion + (goto-char (1- end)) (goto-char (if (equal type "textarea") (1- (line-end-position)) - (eww-end-of-field))) + (1+ (eww-end-of-field)))) (let ((start (point))) (insert (make-string length ? )) (set-text-properties start (point) properties))))) -- 2.39.5