1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-06 04:25:45 +01:00

Merge branch 'master' into xulmus

This commit is contained in:
Doug Kearns
2009-03-24 15:50:53 +11:00
5 changed files with 42 additions and 15 deletions

View File

@@ -147,13 +147,13 @@ function Buffer() //{{{
getter: function () window.fullScreen
});
options.add(["nextpattern"],
options.add(["nextpattern"], // \u00BB is » (>> in a single char)
"Patterns to use when guessing the 'next' page in a document sequence",
"stringlist", "\\bnext\\b,^>$,^(>>|»)$,^(>|»),(>|»)$,\\bmore\\b");
"stringlist", "\\bnext\\b,^>$,^(>>|\u00BB)$,^(>|\u00BB),(>|\u00BB)$,\\bmore\\b");
options.add(["previouspattern"],
options.add(["previouspattern"], // \u00AB is « (<< in a single char)
"Patterns to use when guessing the 'previous' page in a document sequence",
"stringlist", "\\bprev|previous\\b,^<$,^(<<|«)$,^(<|«),(<|«)$");
"stringlist", "\\bprev|previous\\b,^<$,^(<<|\u00AB)$,^(<|\u00AB),(<|\u00AB)$");
options.add(["pageinfo", "pa"], "Desired info on :pa[geinfo]", "charlist", "gfm",
{

View File

@@ -1298,15 +1298,8 @@ function CommandLine() //{{{
// user pressed ENTER to carry out a command
// user pressing ESCAPE is handled in the global onEscape
// FIXME: <Esc> should trigger "cancel" event
// FIXME: This should not be waiting, some kind of callback mechanism on completion would be better.
if (events.isAcceptKey(key))
{
while (completions.context.incomplete)
{
liberator.threadYield(true);
command = this.command;
}
let mode = currentExtendedMode; // save it here, as modes.pop() resets it
keepCommand = true;
currentExtendedMode = null; // Don't let modes.pop trigger "cancel"

View File

@@ -249,6 +249,40 @@ const util = { //{{{
return delimiter + str.replace(/([\\'"])/g, "\\$1").replace("\n", "\\n", "g").replace("\t", "\\t", "g") + delimiter;
},
/**
* Split a string on literal occurances of a marker.
*
* Specifically this ignores occurences preceded by a backslash, or
* contained within 'single' or "double" quotes.
*
* It assumes backslash escaping on strings, and will thus not count quotes
* that are preceded by a backslash or within other quotes as starting or
* ending quoted sections of the string.
*
* @param {string} str
* @param {RegExp} marker
*/
splitLiteral: function splitLiteral(str, marker)
{
let results = [];
let resep = RegExp(/^(([^\\'"]|\\.|'([^\\']|\\.)*'|"([^\\"]|\\.)*")*?)/.source + marker.source);
let cont = true;
while (cont)
{
cont = false;
str = str.replace(resep, function (match, before)
{
results.push(before);
cont = true;
return "";
});
}
results.push(str);
return results;
},
/**
* Converts <b>bytes</b> to a pretty printed data size string.
*
@@ -618,7 +652,7 @@ const util = { //{{{
*/
stringToURLArray: function stringToURLArray(str)
{
let urls = str.split(RegExp("\\s*" + options["urlseparator"] + "\\s*"));
let urls = util.splitLiteral(str, RegExp("\\s*" + options["urlseparator"] + "\\s*"));
return urls.map(function (url) {
try