1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-14 06:35:46 +01:00

Handle sane shells on Windows somewhat better.

This commit is contained in:
Kris Maglione
2010-11-05 13:36:30 -04:00
parent 7815a85d7d
commit 97589ce40b
8 changed files with 46 additions and 44 deletions

View File

@@ -155,8 +155,8 @@ const Browser = Module("browser", {
commands.add(["redr[aw]"],
"Redraw the screen",
function () {
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).redraw();
window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.redraw();
statusline.updateUrl();
commandline.clear();
},

View File

@@ -660,8 +660,7 @@ const Buffer = Module("buffer", {
* controller.
*/
get selectionController() config.browser.docShell
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsISelectionDisplay)
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsISelectionDisplay)
.QueryInterface(Ci.nsISelectionController),
/**
@@ -1483,12 +1482,9 @@ const Buffer = Module("buffer", {
config.browser.addProgressListener(this.progressListener, Ci.nsIWebProgress.NOTIFY_ALL);
window.XULBrowserWindow = this.progressListener;
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow)
window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIXULWindow)
.XULBrowserWindow = this.progressListener;
let appContent = document.getElementById("appcontent");

View File

@@ -594,8 +594,7 @@ const RangeFind = Class("RangeFind", {
this.range = range;
this.document = range.startContainer.ownerDocument;
this.window = this.document.defaultView;
this.docShell = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
this.docShell = this.window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
if (this.selection == null)
@@ -629,8 +628,7 @@ const RangeFind = Class("RangeFind", {
},
get selectionController() this.docShell
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsISelectionDisplay)
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsISelectionDisplay)
.QueryInterface(Ci.nsISelectionController),
get selection() {
try {

View File

@@ -263,7 +263,7 @@ lookup:
}
let process = services.create("process");
let isMain = services.get("threadManager").isMainThread;
let isMain = services.get("threading").isMainThread;
process.init(file);
process.run(blocking && !isMain, args.map(String), args.length);
@@ -294,7 +294,7 @@ lookup:
let dirs = options["runtimepath"];
let found = false;
dactyl.echomsg("Searching for " + paths.join(" ").quote() + " in " + options.get("runtimepath").value, 2);
dactyl.echomsg("Searching for " + paths.join(" ").quote() + " in " + options.get("runtimepath").stringValue, 2);
outer:
for (let [, dir] in Iterator(dirs)) {
@@ -407,7 +407,7 @@ lookup:
stdin.write(input);
// TODO: implement 'shellredir'
if (util.isOS("WINNT")) {
if (util.isOS("WINNT") && !/sh/.test(options["shell"])) {
command = "cd /D " + this.cwd + " && " + command + " > " + stdout.path + " 2>&1" + " < " + stdin.path;
var res = this.run(options["shell"], options["shellcmdflag"].split(/\s+/).concat(command), true);
}
@@ -421,10 +421,8 @@ lookup:
let output = stdout.read();
if (res > 0)
output += "\nshell returned " + res;
// if there is only one \n at the end, chop it off
else if (output && output.indexOf("\n") == output.length - 1)
output = output.substr(0, output.length - 1);
else if (output)
output = output.replace(/^(.*)\n$/, "$1");
return output;
}) || "";
},
@@ -442,14 +440,13 @@ lookup:
*/
withTempFiles: function (func, self) {
let args = util.map(util.range(0, func.length), this.createTempFile);
if (!args.every(util.identity))
return false;
try {
if (!args.every(util.identity))
return false;
return func.apply(self || this, args);
}
finally {
args.forEach(function (f) f.remove(false));
args.forEach(function (f) f && f.remove(false));
}
}
}, {
@@ -731,8 +728,6 @@ lookup:
var shell, shellcmdflag;
if (util.isOS("WINNT")) {
shell = "cmd.exe";
// TODO: setting 'shell' to "something containing sh" updates
// 'shellcmdflag' appropriately at startup on Windows in Vim
shellcmdflag = "/c";
}
else {
@@ -768,7 +763,14 @@ lookup:
options.add(["shellcmdflag", "shcf"],
"Flag passed to shell when executing :! and :run commands",
"string", shellcmdflag);
"string", shellcmdflag,
{
getter: function (value) {
if (this.hasChanged || !util.isOS("WINNT"))
return value;
return /sh/.test(options["shell"]) ? "-c" : "/c";
}
});
options.add(["wildignore", "wig"],
"List of file patterns to ignore when completing files",

View File

@@ -661,7 +661,8 @@ const JavaScript = Module("javascript", {
"Use the JavaScript debugger service for JavaScript completion",
"boolean", false, {
setter: function (value) {
services.get("debugger")[value ? "on" : "off"]();
if (services.get("debugger").isOn != value)
services.get("debugger")[value ? "on" : "off"]();
},
getter: function () services.get("debugger").isOn
});