1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 21:04:12 +01:00
--HG--
branch : testing
This commit is contained in:
Kris Maglione
2010-08-26 15:18:49 -04:00
11 changed files with 58 additions and 48 deletions

7
common/content/autocommands.js Normal file → Executable file
View File

@@ -196,7 +196,12 @@ const AutoCommands = Module("autocommands", {
}
}, {
bang: true,
completer: function (context) completion.autocmdEvent(context),
completer: function (context, args) {
if (args.length == 1)
return completion.autocmdEvent(context);
if (args.length == 3)
return args["-javascript"] ? completion.javascript(context) : completion.ex(context);
},
literal: 2,
options: [[["-javascript", "-js"], commands.OPTION_NOARG]]
});

5
common/content/completion.js Normal file → Executable file
View File

@@ -696,8 +696,11 @@ const Completion = Module("completion", {
if (skip)
context.advance(skip[0].length);
if (complete == null)
complete = options["complete"];
// Will, and should, throw an error if !(c in opts)
Array.forEach(complete || options["complete"], function (c) {
Array.forEach(complete, function (c) {
let completer = completion.urlCompleters[c];
context.fork.apply(context, [c, 0, completion, completer.completer].concat(completer.args));
});

8
common/content/io.js Normal file → Executable file
View File

@@ -924,7 +924,7 @@ lookup:
"List all sourced script names",
function () {
let list = template.tabular(["<SNR>", "Filename"], ["text-align: right; padding-right: 1em;"],
([i + 1, file] for ([i, file] in Iterator(this._scriptNames)))); // TODO: add colon and remove column titles for pedantic Vim compatibility?
([i + 1, file] for ([i, file] in Iterator(io._scriptNames)))); // TODO: add colon and remove column titles for pedantic Vim compatibility?
commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
},
@@ -954,16 +954,16 @@ lookup:
arg = "!" + arg;
// replaceable bang and no previous command?
liberator.assert(!/((^|[^\\])(\\\\)*)!/.test(arg) || this._lastRunCommand,
liberator.assert(!/((^|[^\\])(\\\\)*)!/.test(arg) || io._lastRunCommand,
"E34: No previous command");
// NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable?
// pass through a raw bang when escaped or substitute the last command
arg = arg.replace(/(\\)*!/g,
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", this._lastRunCommand)
function (m) /^\\(\\\\)*!$/.test(m) ? m.replace("\\!", "!") : m.replace("!", io._lastRunCommand)
);
this._lastRunCommand = arg;
io._lastRunCommand = arg;
let output = io.system(arg);

10
common/content/statusline.js Normal file → Executable file
View File

@@ -63,7 +63,15 @@ const StatusLine = Module("statusline", {
function losslessDecodeURI(url) {
// 1. decodeURI decodes %25 to %, which creates unintended
// encoding sequences.
url = url.split("%25").map(decodeURI).join("%25");
url = url.split("%25").map(function (url) {
// Non-UTF-8 complient URLs cause "malformed URI sequence" errors.
try {
return decodeURI(url);
}
catch (e) {
return url;
}
}).join("%25");
// 2. Re-encode whitespace so that it doesn't get eaten away
// by the location bar (bug 410726).
url = url.replace(/[\r\n\t]/g, encodeURIComponent);

View File

@@ -18,14 +18,6 @@ const Util = Module("util", {
this.Array = Util.Array;
},
/**
* Returns true if its argument is an Array object, regardless
* of which context it comes from.
*
* @param {object} obj
*/
isArray: function isArray(obj) Object.prototype.toString.call(obj) == "[object Array]",
/**
* Returns a shallow copy of <b>obj</b>.
*
@@ -454,7 +446,7 @@ const Util = Module("util", {
doc = window.content.document;
if (!elem)
elem = doc;
if (util.isArray(expression))
if (isarray(expression))
expression = util.makeXPath(expression);
let result = doc.evaluate(expression, elem,