Hi,

This patch adds the domain to the filename created by
`edit_field_in_external_editor'. It means one can choose a mode to edit,
specific text from specific domains.

Cheers,
Phil

diff --git a/modules/content-buffer-input.js b/modules/content-buffer-input.js
index e3c0ff0..eb0271c 100644
--- a/modules/content-buffer-input.js
+++ b/modules/content-buffer-input.js
@@ -316,15 +316,17 @@ function edit_field_in_external_editor(buffer, elem) {
     } else if (!(elem instanceof Ci.nsIDOMHTMLTextAreaElement))
         throw interactive_error("Element is not a text field.");
 
-    var name = elem.getAttribute("name");
-    if (!name || name.length == 0)
-        name = elem.getAttribute("id");
-    if (!name)
-        name = "";
-    name = name.replace(/[^a-zA-Z0-9\-_]/g, "");
-    if (name.length == 0)
-        name = "text";
-    name += ".txt";
+    // put the url in for id purposes
+    var name = buffer.document.URL
+        + "-"
+        + ( elem.getAttribute("name")
+            || elem.getAttribute("id")
+            || "textarea" );
+
+    // get rid filesystem unfriendly chars
+    name = name.replace(/[^a-zA-Z0-9\-]+/g, "-")
+        + ".txt";
+
     var file = get_temporary_file(name);
 
     // Write to file
@@ -349,6 +351,7 @@ function edit_field_in_external_editor(buffer, elem) {
         file.remove(false);
     }
 }
+
 interactive("edit-current-field-in-external-editor",
             "Edit the contents of the currently-focused text field in an external editor.",
             function (I) {
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to