]> git.eshelyaron.com Git - emacs.git/commitdiff
eww input field fixup
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 27 Nov 2014 16:19:52 +0000 (17:19 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 27 Nov 2014 16:19:52 +0000 (17:19 +0100)
Fixes: debbugs:19085
(eww-process-text-input): Don't shorten the input field if
deleting at the last character.

lisp/ChangeLog
lisp/net/eww.el

index b0b1d747746a2249f85d8316957acb7420127974..50c8e402f0c45a3e87a58a94a5100738494d537b 100644 (file)
@@ -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.
 
index a8c910945b6d99839ccdd846e7ade9f124f89503..23f3653f362dbaec4ec6a40883a11a4a75b23754 100644 (file)
@@ -953,9 +953,9 @@ appears in a <link> or <a> 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)))))