eww: support disabled and readonly text
authorKenjiro NAKAYAMA <nakayamakenjiro@gmail.com>
Sat, 21 Dec 2013 20:42:23 +0000 (15:42 -0500)
committerTed Zlatanov <tzz@lifelogs.com>
Sat, 21 Dec 2013 20:42:23 +0000 (15:42 -0500)
* net/eww.el (eww-form-text): Support text form with disabled and readonly attributes.

lisp/ChangeLog
lisp/net/eww.el

index 42fd827..0f6f824 100644 (file)
@@ -4,6 +4,8 @@
        (eww-history-browse, eww-history-quit, eww-history-kill)
        (eww-history-mode-map, eww-history-mode): New command and
        functions to list browser histories.
+        (eww-form-text): Support text form with disabled
+        and readonly attributes.
 
 2013-12-21  RĂ¼diger Sonderfeld  <ruediger@c-plusplus.de>
 
index 8bcfb48..36a91f8 100644 (file)
@@ -680,18 +680,22 @@ appears in a <link> or <a> tag."
        (value (or (cdr (assq :value cont)) ""))
        (width (string-to-number
                (or (cdr (assq :size cont))
-                   "40"))))
+                   "40")))
+        (readonly-property (if (or (cdr (assq :disabled cont))
+                                   (cdr (assq :readonly cont)))
+                               'read-only
+                             'inhibit-read-only)))
     (insert value)
     (when (< (length value) width)
       (insert (make-string (- width (length value)) ? )))
     (put-text-property start (point) 'face 'eww-form-text)
     (put-text-property start (point) 'local-map eww-text-map)
-    (put-text-property start (point) 'inhibit-read-only t)
+    (put-text-property start (point) readonly-property t)
     (put-text-property start (point) 'eww-form
-                      (list :eww-form eww-form
-                            :value value
-                            :type type
-                            :name (cdr (assq :name cont))))
+                       (list :eww-form eww-form
+                             :value value
+                             :type type
+                             :name (cdr (assq :name cont))))
     (insert " ")))
 
 (defconst eww-text-input-types '("text" "password" "textarea"