mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 02:08:00 +01:00
Don't close the completion list when leaving command-line mode (e.g., opening the context menu). Fix :pageinfo (which currently lacks a unit test).
--HG-- branch : key-processing
This commit is contained in:
@@ -1420,7 +1420,7 @@ var Buffer = Module("buffer", {
|
|||||||
let arg = args[0];
|
let arg = args[0];
|
||||||
let opt = options.get("pageinfo");
|
let opt = options.get("pageinfo");
|
||||||
|
|
||||||
dactyl.assert(opt.validator(opt.parse(arg)), "E475: Invalid argument: " + arg);
|
dactyl.assert(!arg || opt.validator(opt.parse(arg)), "E475: Invalid argument: " + arg);
|
||||||
buffer.showPageInfo(true, arg);
|
buffer.showPageInfo(true, arg);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -269,22 +269,29 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
get completionList() this._whenReady("completionList", "dactyl-completions"),
|
get completionList() this._whenReady("completionList", "dactyl-completions"),
|
||||||
completionContainer: Class.memoize(function () this.completionList.parentNode),
|
|
||||||
get multilineOutput() this._whenReady("multilineOutput", "dactyl-multiline-output",
|
|
||||||
function (elem) {
|
|
||||||
elem.contentWindow.addEventListener("unload", function (event) { event.preventDefault(); }, true);
|
|
||||||
elem.contentDocument.documentElement.id = "dactyl-multiline-output-top";
|
|
||||||
elem.contentDocument.body.id = "dactyl-multiline-output-content";
|
|
||||||
|
|
||||||
|
completionContainer: Class.memoize(function () this.completionList.parentNode),
|
||||||
|
|
||||||
|
contextMenu: Class.memoize(function () {
|
||||||
["copy", "copylink", "selectall"].forEach(function (tail) {
|
["copy", "copylink", "selectall"].forEach(function (tail) {
|
||||||
// some host apps use "hostPrefixContext-copy" ids
|
// some host apps use "hostPrefixContext-copy" ids
|
||||||
let xpath = "//xul:menuitem[contains(@id, '" + "ontext-" + tail + "') and not(starts-with(@id, 'dactyl-'))]";
|
let xpath = "//xul:menuitem[contains(@id, '" + "ontext-" + tail + "') and not(starts-with(@id, 'dactyl-'))]";
|
||||||
document.getElementById("dactyl-context-" + tail).style.listStyleImage =
|
document.getElementById("dactyl-context-" + tail).style.listStyleImage =
|
||||||
util.computedStyle(util.evaluateXPath(xpath, document).snapshotItem(0)).listStyleImage;
|
util.computedStyle(util.evaluateXPath(xpath, document).snapshotItem(0)).listStyleImage;
|
||||||
});
|
});
|
||||||
|
return document.getElementById("dactyl-contextmenu");
|
||||||
|
}),
|
||||||
|
|
||||||
|
get multilineOutput() this._whenReady("multilineOutput", "dactyl-multiline-output",
|
||||||
|
function (elem) {
|
||||||
|
elem.contentWindow.addEventListener("unload", function (event) { event.preventDefault(); }, true);
|
||||||
|
elem.contentDocument.documentElement.id = "dactyl-multiline-output-top";
|
||||||
|
elem.contentDocument.body.id = "dactyl-multiline-output-content";
|
||||||
return elem;
|
return elem;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
multilineInput: Class.memoize(function () document.getElementById("dactyl-multiline-input")),
|
multilineInput: Class.memoize(function () document.getElementById("dactyl-multiline-input")),
|
||||||
|
|
||||||
mowContainer: Class.memoize(function () document.getElementById("dactyl-multiline-output-container"))
|
mowContainer: Class.memoize(function () document.getElementById("dactyl-multiline-output-container"))
|
||||||
}, {
|
}, {
|
||||||
getEditor: function getEditor(elem) {
|
getEditor: function getEditor(elem) {
|
||||||
@@ -331,16 +338,16 @@ var CommandMode = Class("CommandMode", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
leave: function (stack) {
|
leave: function (stack) {
|
||||||
if (this.completions)
|
|
||||||
this.completions.cleanup();
|
|
||||||
|
|
||||||
if (this.history)
|
|
||||||
this.history.save();
|
|
||||||
|
|
||||||
commandline.hideCompletions();
|
|
||||||
this.resetCompletions();
|
|
||||||
|
|
||||||
if (!stack.push) {
|
if (!stack.push) {
|
||||||
|
if (this.completions)
|
||||||
|
this.completions.cleanup();
|
||||||
|
|
||||||
|
if (this.history)
|
||||||
|
this.history.save();
|
||||||
|
|
||||||
|
commandline.hideCompletions();
|
||||||
|
this.resetCompletions();
|
||||||
|
|
||||||
modes.delay(function () {
|
modes.delay(function () {
|
||||||
if (!this.keepCommand || commandline.silent || commandline.quiet)
|
if (!this.keepCommand || commandline.silent || commandline.quiet)
|
||||||
commandline.hide();
|
commandline.hide();
|
||||||
@@ -1120,6 +1127,7 @@ var CommandLine = Module("commandline", {
|
|||||||
|
|
||||||
if (show) {
|
if (show) {
|
||||||
this.itemList.reset();
|
this.itemList.reset();
|
||||||
|
this.itemList.visible = true;
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.wildIndex = 0;
|
this.wildIndex = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,13 +172,14 @@ var MOW = Module("mow", {
|
|||||||
},
|
},
|
||||||
contextEvents: {
|
contextEvents: {
|
||||||
popupshowing: function (event) {
|
popupshowing: function (event) {
|
||||||
|
let menu = commandline.widgets.contextMenu;
|
||||||
let enabled = {
|
let enabled = {
|
||||||
link: window.document.popupNode instanceof HTMLAnchorElement,
|
link: window.document.popupNode instanceof HTMLAnchorElement,
|
||||||
path: window.document.popupNode.hasAttribute("path"),
|
path: window.document.popupNode.hasAttribute("path"),
|
||||||
selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed
|
selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let node in array.iterValues(event.target.children)) {
|
for (let node in array.iterValues(menu.children)) {
|
||||||
let group = node.getAttributeNS(NS, "group");
|
let group = node.getAttributeNS(NS, "group");
|
||||||
node.hidden = group && !group.split(/\s+/).every(function (g) enabled[g]);
|
node.hidden = group && !group.split(/\s+/).every(function (g) enabled[g]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user