1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-16 14:15:49 +01:00

Import some fixes from Vimperator. Thanks anekos, teramoko, and stepnem.

This commit is contained in:
Kris Maglione
2010-09-18 03:42:48 -04:00
parent bc7cff0442
commit 508cc08a8f
10 changed files with 36 additions and 28 deletions

View File

@@ -1142,8 +1142,9 @@ const CommandLine = Module("commandline", {
// Change the completion text.
// The second line is a hack to deal with some substring
// preview corner cases.
commandline.widgets.command.value = this.prefix + completion + this.suffix;
this.editor.selection.focusNode.textContent = commandline.widgets.command.value;
let value = this.prefix + completion + this.suffix;
commandline.widgets.command.value = value;
this.editor.selection.focusNode.textContent = value;
// Reset the caret to one position after the completion.
this.caret = this.prefix.length + completion.length;

View File

@@ -973,11 +973,11 @@ const Commands = Module("commands", {
bookmark: "bookmark", buffer: "buffer", color: "colorScheme",
command: "command", dialog: "dialog", dir: "directory",
environment: "environment", event: "autocmdEvent", file: "file",
help: "help", highlight: "highlightGroup", javascript: "javascript",
macro: "macro", mapping: "userMapping", menu: "menuItem",
option: "option", preference: "preference", search: "search",
shellcmd: "shellCommand", sidebar: "sidebar", url: "url",
usercommand: "userCommand"
help: "help", highlight: "highlightGroup", history: "history",
javascript: "javascript", macro: "macro", mapping: "userMapping",
menu: "menuItem", option: "option", preference: "preference",
search: "search", shellcmd: "shellCommand", sidebar: "sidebar",
url: "url", usercommand: "userCommand"
};
// TODO: Vim allows commands to be defined without {rep} if there are {attr}s
@@ -1018,7 +1018,7 @@ const Commands = Module("commands", {
};
}
else
completeFunc = completion[completeOptionMap[completeOpt]];
completeFunc = completion.closure[completeOptionMap[completeOpt]];
}
let added = commands.addUserCommand([cmd],

View File

@@ -554,8 +554,8 @@ const Editor = Module("editor", {
getAbbreviations: function (filter, lhs) {
// ! -> list all, on c or i ! matches too
let searchFilter = (filter == "!") ? "!ci" : filter + "!";
return list = [[mode, left, right] for ([left, [mode, right]] in this.abbrevs())
if (searchFilter.indexOf(mode) >= 0 && left.indexOf(lhs || "") == 0)];
return [[mode, left, right] for ([left, [mode, right]] in this.abbrevs())
if (searchFilter.indexOf(mode) >= 0 && left.indexOf(lhs || "") == 0)];
},
/**
@@ -968,11 +968,8 @@ const Editor = Module("editor", {
editor.executeCommand("cmd_copy");
modes.set(modes.TEXTAREA);
}
else {
let sel = window.content.document.getSelection();
dactyl.assert(sel);
dactyl.clipboardWrite(sel, true);
}
else
dactyl.clipboardWrite(buffer.getCurrentWord(), true);
});
mappings.add([modes.VISUAL, modes.TEXTAREA],

View File

@@ -194,7 +194,7 @@ const Events = Module("events", {
* Replays a macro.
*
* @param {string} The name of the macro to replay.
* @return {boolean}
* @returns {boolean}
*/
playMacro: function (macro) {
let res = false;
@@ -411,7 +411,7 @@ const Events = Module("events", {
* <S-@> where @ is a non-case-changable, non-space character.
*
* @param {string} keys The string to parse.
* @return {Array[Object]}
* @returns {Array[Object]}
*/
fromString: function (input) {
let out = [];

View File

@@ -604,7 +604,7 @@ const JavaScript = Module("javascript", {
options.add(["jsdebugger", "jsd"],
"Switch on/off jsdebugger",
"boolean", false, {
setter: function(value) {
setter: function (value) {
if (value)
services.get("debugger").on();
else

View File

@@ -283,8 +283,8 @@ const Tabs = Module("tabs", {
/**
* Removes the specified <b>tab</b> from the tab list.
*
* @param {Object} tab
* @param {number} count
* @param {Object} tab The tab to remove.
* @param {number} count How many tabs to remove.
* @param {boolean} focusLeftTab Focus the tab to the left of the removed tab.
* @param {number} quitOnLastTab Whether to quit if the tab being
* deleted is the only tab in the tab list: