mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 05:42:27 +01:00
Allow argument to :w
This commit is contained in:
@@ -231,7 +231,7 @@ liberator.Buffer = function () //{{{
|
||||
{
|
||||
consoleService.registerListener(listener);
|
||||
if (testDoc.documentElement.firstChild)
|
||||
testDoc.documentElement.removeChild(testDoc.documentElement.firstChild);
|
||||
testDoc.documentElement.removeChild(testDoc.lastChild);
|
||||
testDoc.documentElement.appendChild(util.xmlToDom(
|
||||
<html><head><link type="text/css" rel="stylesheet" href={uri}/></head></html>, testDoc));
|
||||
|
||||
@@ -473,7 +473,7 @@ liberator.Buffer = function () //{{{
|
||||
{
|
||||
if (liberator.mappings.repeat)
|
||||
{
|
||||
for (let i in liberator.util.range(0, count || 1))
|
||||
for (let i in liberator.util.rangeInterruptable(0, count || 1, 100))
|
||||
liberator.mappings.repeat();
|
||||
}
|
||||
},
|
||||
@@ -797,20 +797,29 @@ liberator.Buffer = function () //{{{
|
||||
"Save current document to disk",
|
||||
function (args, special)
|
||||
{
|
||||
//var file = liberator.io.getFile(args || "");
|
||||
// we always want to save that link relative to the current working directory
|
||||
let doc = window.content.document;
|
||||
let file = liberator.io.getFile(args || "");
|
||||
if (args && file.exists() && !special)
|
||||
return liberator.echoerr("E13: File exists (add ! to override)");
|
||||
|
||||
liberator.options.setPref("browser.download.lastDir", liberator.io.getCurrentDirectory());
|
||||
//if (args)
|
||||
//{
|
||||
// saveURL(liberator.buffer.URL, args, null, true, special, // special == skipPrompt
|
||||
// makeURI(liberator.buffer.URL, content.document.characterSet));
|
||||
//}
|
||||
//else
|
||||
saveDocument(window.content.document, special);
|
||||
try
|
||||
{
|
||||
var contentDisposition = window.content
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||
.getDocumentMetadata("content-disposition");
|
||||
} catch (e) {}
|
||||
|
||||
internalSave(doc.location.href, doc, null, contentDisposition,
|
||||
doc.contentType, false, null,
|
||||
args && { file: file, uri: makeURI(doc.location.href, doc.characterSet) },
|
||||
doc.referrer ? makeURI(doc.referrer) : null,
|
||||
true);
|
||||
},
|
||||
{
|
||||
argCount: "0",
|
||||
bang: true
|
||||
bang: true,
|
||||
completer: function (filter) liberator.completion.file(filter)
|
||||
});
|
||||
|
||||
liberator.commands.add(["st[op]"],
|
||||
|
||||
@@ -535,6 +535,27 @@ liberator.Events = function () //{{{
|
||||
}
|
||||
}
|
||||
|
||||
function wrapListener(method)
|
||||
{
|
||||
return function (event)
|
||||
{
|
||||
try
|
||||
{
|
||||
liberator.dump(event);
|
||||
eventManager[method](event);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
if (e.message == "Interrupted")
|
||||
liberator.echoerr("Interrupted");
|
||||
else
|
||||
liberator.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
|
||||
if (Components.utils.reportError)
|
||||
Components.utils.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return true when load successful, or false otherwise
|
||||
function waitForPageLoaded()
|
||||
{
|
||||
@@ -1195,6 +1216,13 @@ liberator.Events = function () //{{{
|
||||
}
|
||||
}
|
||||
|
||||
if (key == "<C-c>")
|
||||
liberator.interrupted = true;
|
||||
|
||||
// feedingKeys needs to be separate from interrupted so
|
||||
// we can differentiate between a recorded <C-c>
|
||||
// interrupting whatever it's started and a real <C-c>
|
||||
// interrupting our playback.
|
||||
if (liberator.events.feedingKeys)
|
||||
{
|
||||
if (key == "<C-c>" && !event.isMacro)
|
||||
@@ -1207,9 +1235,6 @@ liberator.Events = function () //{{{
|
||||
}
|
||||
}
|
||||
|
||||
if (key == "<C-c>")
|
||||
liberator.interrupted = true;
|
||||
|
||||
var stop = true; // set to false if we should NOT consume this event but let Firefox handle it
|
||||
|
||||
var win = document.commandDispatcher.focusedWindow;
|
||||
@@ -1611,9 +1636,9 @@ liberator.Events = function () //{{{
|
||||
eventManager.prefObserver.unregister();
|
||||
});
|
||||
|
||||
window.addEventListener("keypress", eventManager.onKeyPress, true);
|
||||
window.addEventListener("keydown", eventManager.onKeyUpOrDown, true);
|
||||
window.addEventListener("keyup", eventManager.onKeyUpOrDown, true);
|
||||
window.addEventListener("keypress", wrapListener("onKeyPress"), true);
|
||||
window.addEventListener("keydown", wrapListener("onKeyUpOrDown"), true);
|
||||
window.addEventListener("keyup", wrapListener("onKeyUpOrDown"), true);
|
||||
|
||||
return eventManager;
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ liberator.CommandLine = function () //{{{
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
liberator.echoerr(e.toString());
|
||||
liberator.echoerr(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user