Commit 57134666 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

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).
parent 51362d68
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment