1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 20:24:14 +01:00

Merge branch 'master' into vimperator-2.1

This commit is contained in:
Doug Kearns
2009-03-11 00:02:00 +11:00
17 changed files with 136 additions and 111 deletions

View File

@@ -658,7 +658,6 @@ CompletionContext.prototype = {
this.tabPressed = false;
this.title = ["Completions"];
this.updateAsync = false;
this.waitingForTab = false;
this.cancelAll();
@@ -677,7 +676,6 @@ CompletionContext.prototype = {
for each (let context in this.contexts)
{
context.hasItems = false;
context.incomplete = false;
}
},

View File

@@ -639,7 +639,7 @@ function Events() //{{{
{
for (let [,dir] in Iterator(dirs))
{
liberator.echomsg('Searching for "macros/*" in ' + dir.path.quote(), 2);
liberator.echomsg('Searching for "macros/*" in "' + dir.path + '"', 2);
liberator.log("Sourcing macros directory: " + dir.path + "...", 3);

View File

@@ -245,7 +245,7 @@ function IO() //{{{
if (!found)
{
liberator.echoerr("E344: Can't find directory " + arg.quote() + " in cdpath\n"
liberator.echoerr("E344: Can't find directory \"" + arg + "\" in cdpath\n"
+ "E472: Command failed");
}
}
@@ -278,7 +278,7 @@ function IO() //{{{
if (file.exists() && !args.bang)
{
liberator.echoerr("E189: " + filename.quote() + " exists (add ! to override)");
liberator.echoerr("E189: \"" + filename + "\" exists (add ! to override)");
return;
}
@@ -297,7 +297,7 @@ function IO() //{{{
}
catch (e)
{
liberator.echoerr("E190: Cannot open " + filename.quote() + " for writing");
liberator.echoerr("E190: Cannot open \"" + filename + "\" for writing");
liberator.log("Could not write to " + file.path + ": " + e.message); // XXX
}
},
@@ -514,7 +514,7 @@ function IO() //{{{
if (!dir.exists() || !dir.isDirectory())
{
liberator.echoerr("E344: Can't find directory " + dir.path.quote() + " in path");
liberator.echoerr("E344: Can't find directory \"" + dir.path + "\" in path");
return null;
}
@@ -835,7 +835,7 @@ lookup:
let found = false;
// FIXME: should use original arg string
liberator.echomsg("Searching for " + paths.join(" ").quote() + " in " + options["runtimepath"].quote(), 2);
liberator.echomsg("Searching for \"" + paths.join(" ") + "\" in \"" + options["runtimepath"] + "\"", 2);
outer:
for (let [,dir] in Iterator(dirs))
@@ -844,7 +844,7 @@ lookup:
{
let file = joinPaths(dir, path);
liberator.echomsg("Searching for " + file.path.quote(), 3);
liberator.echomsg("Searching for \"" + file.path + "\"", 3);
if (file.exists() && file.isFile() && file.isReadable())
{
@@ -858,7 +858,7 @@ lookup:
}
if (!found)
liberator.echomsg("not found in 'runtimepath': " + paths.join(" ").quote(), 1); // FIXME: should use original arg string
liberator.echomsg("not found in 'runtimepath': \"" + paths.join(" ") + "\"", 1); // FIXME: should use original arg string
return found;
},
@@ -885,9 +885,9 @@ lookup:
if (!silent)
{
if (file.exists() && file.isDirectory())
liberator.echomsg("Cannot source a directory: " + filename.quote(), 0);
liberator.echomsg("Cannot source a directory: \"" + filename + "\"", 0);
else
liberator.echomsg("could not source: " + filename.quote(), 1);
liberator.echomsg("could not source: \"" + filename + "\"", 1);
liberator.echoerr("E484: Can't open file " + filename);
}
@@ -895,7 +895,7 @@ lookup:
return;
}
liberator.echomsg("sourcing " + filename.quote(), 2);
liberator.echomsg("sourcing \"" + filename + "\"", 2);
let str = self.readFile(file);
let uri = services.get("io").newFileURI(file);
@@ -1005,7 +1005,7 @@ lookup:
if (scriptNames.indexOf(file.path) == -1)
scriptNames.push(file.path);
liberator.echomsg("finished sourcing " + filename.quote(), 2);
liberator.echomsg("finished sourcing \"" + filename + "\"", 2);
liberator.log("Sourced: " + filename, 3);
}

View File

@@ -1029,11 +1029,11 @@ const liberator = (function () //{{{
return;
}
liberator.echomsg('Searching for "plugin/**/*.{js,vimp}" in '
+ [dir.path.replace(/.plugin$/, "") for each (dir in dirs)].join(",").quote(), 2);
liberator.echomsg('Searching for "plugin/**/*.{js,vimp}" in "'
+ [dir.path.replace(/.plugin$/, "") for each (dir in dirs)].join(",") + '"', 2);
dirs.forEach(function (dir) {
liberator.echomsg("Searching for " + (dir.path + "/**/*.{js,vimp}").quote(), 3);
liberator.echomsg("Searching for \"" + (dir.path + "/**/*.{js,vimp}") + "\"", 3);
sourceDirectory(dir);
});
},
@@ -1426,16 +1426,24 @@ window.liberator = liberator;
// FIXME: Ugly, etc.
window.addEventListener("liberatorHelpLink", function (event) {
let elem = event.target;
if (/^(option|mapping|command)$/.test(elem.className))
var tag = elem.textContent.replace(/\s.*/, "");
if (/^(mapping|command)$/.test(elem.className))
tag = tag.replace(/^\d+/, "");
if (elem.className == "command")
tag = tag.replace(/\[.*?\]/g, "");
tag = tag.replace(/\[.*?\]/g, "").replace(/!$/, "");
if (tag)
var page = liberator.findHelp(tag);
if (page)
{
elem.href = "chrome://liberator/locale/" + page;
},
true, true);
if (buffer.URL.replace(/#.*/, "") == elem.href.replace(/#.*/, "")) // XXX
setTimeout(function () { content.postMessage("fragmentChange", "*"); }, 0);
}
}, true, true);
// called when the chrome is fully loaded and before the main window is shown
window.addEventListener("load", liberator.startup, false);

View File

@@ -224,6 +224,7 @@ const template = {
return s + <>{str.substr(start)}</>;
},
// FIXME: why is href="#"?
highlightURL: function highlightURL(str, force)
{
if (force || /^[a-zA-Z]+:\/\//.test(str))
@@ -263,7 +264,7 @@ const template = {
<td class="indicator">{idx == index ? ">" : ""}</td>
<td>{Math.abs(idx - index)}</td>
<td style="width: 250px; max-width: 500px; overflow: hidden;">{val.title}</td>
<td><a href="#" highlight="URL jump-list">{val.URI.spec}</a></td>
<td><a href={val.URI.spec} highlight="URL jump-list">{val.URI.spec}</a></td>
</tr>)
}
</table>);

View File

@@ -1221,7 +1221,7 @@ function CommandLine() //{{{
submit: callback,
change: extra.onChange,
complete: extra.completer,
cancel: extra.onCancel,
cancel: extra.onCancel
};
modes.push(modes.COMMAND_LINE, modes.PROMPT);
@@ -1423,25 +1423,53 @@ function CommandLine() //{{{
let closeWindow = false;
let passEvent = false;
function isScrollable() !win.scrollMaxY == 0;
function atEnd() win.scrollY / win.scrollMaxY >= 1;
let key = events.toString(event);
if (event.type == "click")
// TODO: Wouldn't multiple handlers be cleaner? --djk
if (event.type == "click" && event.target instanceof HTMLAnchorElement)
{
if (event.target instanceof HTMLAnchorElement && event.button < 2)
function openLink(where)
{
event.preventDefault();
let target = event.button == 0 ? liberator.CURRENT_TAB : liberator.NEW_TAB;
// FIXME: Why is this needed? --djk
if (event.target.getAttribute("href") == "#")
liberator.open(event.target.textContent, target);
liberator.open(event.target.textContent, where);
else
liberator.open(event.target.href, target);
liberator.open(event.target.href, where);
}
switch (key)
{
case "<LeftMouse>":
// FIXME: the :ls output no longer wraps the buffer URL in an anchor element
if (event.originalTarget.getAttributeNS(NS.uri, "highlight") == "URL buffer-list")
{
event.preventDefault();
tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
}
else
{
openLink(liberator.CURRENT_TAB);
}
break;
case "<MiddleMouse>":
case "<C-LeftMouse>":
case "<C-M-LeftMouse>":
openLink(liberator.NEW_BACKGROUND_TAB);
break;
case "<S-MiddleMouse>":
case "<C-S-LeftMouse>":
case "<C-M-S-LeftMouse>":
openLink(liberator.NEW_TAB);
break;
case "<S-LeftMouse>":
openLink(liberator.NEW_WINDOW);
break;
}
return;
}
let key = events.toString(event);
if (startHints)
{
statusline.updateInputBuffer("");
@@ -1450,6 +1478,9 @@ function CommandLine() //{{{
return;
}
function isScrollable() !win.scrollMaxY == 0;
function atEnd() win.scrollY / win.scrollMaxY >= 1;
switch (key)
{
case "<Esc>":
@@ -1499,34 +1530,6 @@ function CommandLine() //{{{
break;
// TODO: <LeftMouse> on the prompt line should scroll one page
case "<LeftMouse>":
if (event.originalTarget.getAttributeNS(NS.uri, "highlight") == "URL buffer-list")
{
tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
closeWindow = true;
break;
}
else if (event.originalTarget.localName.toLowerCase() == "a")
{
liberator.open(event.originalTarget.textContent);
break;
}
case "<A-LeftMouse>": // for those not owning a 3-button mouse
case "<MiddleMouse>":
if (event.originalTarget.localName.toLowerCase() == "a")
{
let where = /\btabopen\b/.test(options["activate"]) ?
liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB;
liberator.open(event.originalTarget.textContent, where);
}
break;
// let Firefox handle those to select table cells or show a context menu
case "<C-LeftMouse>":
case "<RightMouse>":
case "<C-S-LeftMouse>":
break;
// page down
case "f":
if (options["more"] && isScrollable())
@@ -1617,7 +1620,7 @@ function CommandLine() //{{{
if (passEvent)
events.onKeyPress(event);
}
else // set update the prompt string
else
{
commandline.updateMorePrompt(showMorePrompt, showMoreHelpPrompt);
}
@@ -1721,7 +1724,7 @@ function ItemList(id) //{{{
if (!iframe)
{
liberator.log("No iframe with id: " + id + " found, strange things may happen!"); // "The truth is out there..." -- djk
return;
return; // XXX
}
function dom(xml, map) util.xmlToDom(xml, doc, map);

View File

@@ -577,7 +577,7 @@ const util = { //{{{
*/
readFromClipboard: function readFromClipboard()
{
let url;
let str;
try
{
@@ -599,12 +599,12 @@ const util = { //{{{
if (data)
{
data = data.value.QueryInterface(Ci.nsISupportsString);
url = data.data.substring(0, dataLen.value / 2);
str = data.data.substring(0, dataLen.value / 2);
}
}
catch (e) {}
return url;
return str;
},
/**