The url and alternate-url browser objects now default to the url of
the current buffer. This means that "g RET" will reload the current
buffer and "C-u g RET" will duplicate the current buffer. For
consistency, "C-x C-v DEL RET" will also reload the current buffer,
but that's less likely to be useful.
There is no new functionality, but keystrokes which were not useful
now do something sensible.
---
> What about, instead, using the alternate-url browser object as the
> default for find-url, and modifying that browser object to select the url?
I'm not sure what you mean; is this close to what you had in mind? I
agree that it makes more sense to do the selection in the browser
object.
I couldn't see a way to pass a parameter to the browser object handler
to select whether or not the current url is presented for editing.
Instead, I generate the handler for the two cases, but this seems a
bit heavy handed.
regards, David.
modules/commands.js | 12 +-----------
modules/content-buffer.js | 3 +--
modules/element.js | 23 ++++++++++++++++++-----
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/modules/commands.js b/modules/commands.js
index a53b7fe..997f4e7 100644
--- a/modules/commands.js
+++ b/modules/commands.js
@@ -419,17 +419,7 @@ interactive("find-url-new-window", "Open a URL in a new
window",
interactive("find-alternate-url", "Edit the current URL in the minibuffer",
"find-url",
- $browser_object =
- define_browser_object_class(
- "alternate-url", null, null,
- function (buf, prompt) {
- check_buffer (buf, content_buffer);
- var result = yield buf.window.minibuffer.read_url (
- $prompt = prompt,
- $initial_value = buf.display_URI_string);
- yield co_return (result);
- }));
-
+ $browser_object = browser_object_alternate_url);
interactive("go-up", "Go to the parent directory of the current URL",
"find-url",
diff --git a/modules/content-buffer.js b/modules/content-buffer.js
index 87c99d1..68c1154 100644
--- a/modules/content-buffer.js
+++ b/modules/content-buffer.js
@@ -309,8 +309,7 @@ minibuffer.prototype.read_url = function () {
$auto_complete = "url",
$select,
$match_required = false);
- if (result == "") // well-formedness check. (could be better!)
- throw ("invalid url or webjump (\""+ result +"\")");
+ // todo: well-formedness check
yield co_return(result);
};
/*
diff --git a/modules/element.js b/modules/element.js
index 745ee52..4845543 100644
--- a/modules/element.js
+++ b/modules/element.js
@@ -89,13 +89,26 @@ define_browser_object_class(
"top", null, null,
function (buf, prompt) { yield co_return(buf.top_frame); });
-define_browser_object_class(
- "url", null, null,
- function (buf, prompt) {
+function browser_object_url_handler_generator (offer_initial) {
+ return function (buf, prompt) {
check_buffer (buf, content_buffer);
- var result = yield buf.window.minibuffer.read_url ($prompt = prompt);
+ var current_uri = buf.display_URI_string;
+ var result = yield buf.window.minibuffer.read_url (
+ $prompt = prompt,
+ $initial_value = offer_initial ? current_uri : null);
+ if (result.length == 0)
+ result = current_uri;
yield co_return (result);
- });
+ }
+}
+
+define_browser_object_class(
+ "url", null, null,
+ browser_object_url_handler_generator(false));
+
+define_browser_object_class(
+ "alternate-url", null, null,
+ browser_object_url_handler_generator(true));
define_browser_object_class(
"alt", "Image Alt-text", null,
--
--
IMPORTANT: This email remains the property of the Australian Defence
Organisation and is subject to the jurisdiction of section 70 of the
CRIMES ACT 1914. If you have received this email in error, you are
requested to contact the sender and delete the email.
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror