1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

Fix editing undo changes in eww fields

* eww.el (eww-tag-form): Don't overwrite initial form data in text
fields.
(eww-process-text-input): Make `M-t' at the end of text fields work
better (bug#19085).
This commit is contained in:
Lars Ingebrigtsen 2016-02-02 18:00:02 +11:00
parent 51362d68d1
commit 5713466646

View File

@ -921,6 +921,7 @@ network, but just re-display the HTML already fetched."
(let ((eww-form (list (cons :method (dom-attr dom 'method))
(cons :action (dom-attr dom 'action))))
(start (point)))
(insert "\n")
(shr-ensure-paragraph)
(shr-generic dom)
(unless (bolp)
@ -1030,6 +1031,7 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
(1- end)))))
(let* ((form (get-text-property pos 'eww-form))
(properties (text-properties-at pos))
(buffer-undo-list t)
(inhibit-read-only t)
(length (- end beg replace-length))
(type (plist-get form :type)))
@ -1050,13 +1052,13 @@ 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 end)
(goto-char
(if (equal type "textarea")
(1- (line-end-position))
(1+ (eww-end-of-field))))
(let ((start (point)))
(insert (make-string (abs length) ? ))
(insert (make-string (abs length) ? ))
(set-text-properties start (point) properties))
(goto-char (1- end)))))
(set-text-properties (plist-get form :start) (plist-get form :end)
@ -1070,8 +1072,9 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
(when (equal type "password")
;; Display passwords as asterisks.
(let ((start (eww-beginning-of-field)))
(put-text-property start (+ start (length value))
'display (make-string (length value) ?*)))))))))
(put-text-property
start (+ start (length value))
'display (make-string (length value) ?*)))))))))
(defun eww-tag-textarea (dom)
(let ((start (point))