1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 08:07:59 +01:00

Keep browser from exploding on <C-i> in Command Line mode.

This commit is contained in:
Kris Maglione
2011-08-08 15:26:24 -04:00
parent a3f2c02196
commit 4470f63f74
2 changed files with 17 additions and 5 deletions

View File

@@ -152,10 +152,12 @@ var AutoCommands = Module("autocommands", {
else else
var { uri, doc } = buffer; var { uri, doc } = buffer;
let baseArgs = update({ doc: doc }, arguments[1]);
event = event.toLowerCase(); event = event.toLowerCase();
for (let hive in values(this.matchingHives(uri, doc))) { for (let hive in values(this.matchingHives(uri, doc))) {
let args = update({}, let args = update({},
hive.argsExtra(arguments[1]), hive.argsExtra(baseArgs),
arguments[1]); arguments[1]);
for (let autoCmd in values(hive._store)) for (let autoCmd in values(hive._store))

View File

@@ -188,6 +188,7 @@ var Editor = Module("editor", {
let textBox = config.isComposeWindow ? null : dactyl.focusedElement; let textBox = config.isComposeWindow ? null : dactyl.focusedElement;
let line, column; let line, column;
let keepFocus = modes.stack.some(function (m) isinstance(m.main, modes.COMMAND_LINE));
if (!forceEditing && textBox && textBox.type == "password") { if (!forceEditing && textBox && textBox.type == "password") {
commandline.input(_("editor.prompt.editPassword") + " ", commandline.input(_("editor.prompt.editPassword") + " ",
@@ -228,6 +229,7 @@ var Editor = Module("editor", {
tmpfile.remove(false); tmpfile.remove(false);
if (textBox) { if (textBox) {
if (!keepFocus)
dactyl.focus(textBox); dactyl.focus(textBox);
for (let group in values(blink.concat(blink, ""))) { for (let group in values(blink.concat(blink, ""))) {
highlight.highlightNode(textBox, origGroup + " " + group); highlight.highlightNode(textBox, origGroup + " " + group);
@@ -245,11 +247,13 @@ var Editor = Module("editor", {
if (textBox) { if (textBox) {
textBox.value = val; textBox.value = val;
if (false) {
textBox.setAttributeNS(NS, "modifiable", true); textBox.setAttributeNS(NS, "modifiable", true);
util.computedStyle(textBox).MozUserInput; util.computedStyle(textBox).MozUserInput;
events.dispatch(textBox, events.create(textBox.ownerDocument, "input", {})); events.dispatch(textBox, events.create(textBox.ownerDocument, "input", {}));
textBox.removeAttributeNS(NS, "modifiable"); textBox.removeAttributeNS(NS, "modifiable");
} }
}
else { else {
while (editor_.rootElement.firstChild) while (editor_.rootElement.firstChild)
editor_.rootElement.removeChild(editor_.rootElement.firstChild); editor_.rootElement.removeChild(editor_.rootElement.firstChild);
@@ -258,12 +262,14 @@ var Editor = Module("editor", {
} }
try { try {
util.dump(textBox);
var tmpfile = io.createTempFile(); var tmpfile = io.createTempFile();
if (!tmpfile) if (!tmpfile)
throw Error(_("io.cantCreateTempFile")); throw Error(_("io.cantCreateTempFile"));
if (textBox) { if (textBox) {
highlight.highlightNode(textBox, origGroup + " EditorEditing"); highlight.highlightNode(textBox, origGroup + " EditorEditing");
if (!keepFocus)
textBox.blur(); textBox.blur();
} }
@@ -368,10 +374,14 @@ var Editor = Module("editor", {
Map.types["editor"] = { Map.types["editor"] = {
preExecute: function preExecute(args) { preExecute: function preExecute(args) {
Editor.getEditor(null).beginTransaction(); let editor = Editor.getEditor(null)
if (editor)
editor.beginTransaction();
}, },
postExecute: function preExecute(args) { postExecute: function preExecute(args) {
Editor.getEditor(null).endTransaction(); let editor = Editor.getEditor(null)
if (editor)
editor.endTransaction();
}, },
}; };
Map.types["operator"] = { Map.types["operator"] = {