mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 23:58:00 +01:00
Add 'altwildmode'.
This commit is contained in:
@@ -95,7 +95,7 @@ const CommandLine = Module("commandline", {
|
|||||||
this._tabTimer = Timer(0, 0, function tabTell(event) {
|
this._tabTimer = Timer(0, 0, function tabTell(event) {
|
||||||
dactyl.trapErrors(function () {
|
dactyl.trapErrors(function () {
|
||||||
if (self._completions)
|
if (self._completions)
|
||||||
self._completions.tab(event.shiftKey);
|
self._completions.tab(event.shiftKey, event.altKey && options.get("altwildmode").values);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -658,7 +658,7 @@ const CommandLine = Module("commandline", {
|
|||||||
this._history.select(/Up/.test(key), !/(Page|S-)/.test(key));
|
this._history.select(/Up/.test(key), !/(Page|S-)/.test(key));
|
||||||
}
|
}
|
||||||
// user pressed <Tab> to get completions of a command
|
// user pressed <Tab> to get completions of a command
|
||||||
else if (/^<(Tab|S-Tab)>$/.test(key)) {
|
else if (/^<(?:A-)?(?:S-)?Tab>$/.test(key)) {
|
||||||
// prevent tab from moving to the next field
|
// prevent tab from moving to the next field
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -682,7 +682,7 @@ const CommandLine = Module("commandline", {
|
|||||||
}
|
}
|
||||||
else if (event.type == "keyup") {
|
else if (event.type == "keyup") {
|
||||||
let key = events.toString(event);
|
let key = events.toString(event);
|
||||||
if (/^<(Tab|S-Tab)>$/.test(key))
|
if (/^<(?:A-)?(?:S-)?Tab>$/.test(key))
|
||||||
this._tabTimer.flush();
|
this._tabTimer.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1120,6 +1120,7 @@ const CommandLine = Module("commandline", {
|
|||||||
this.editor = input.editor;
|
this.editor = input.editor;
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.wildmode = options.get("wildmode");
|
this.wildmode = options.get("wildmode");
|
||||||
|
this.wildtypes = this.wildmode.values;
|
||||||
this.itemList = commandline._completionList;
|
this.itemList = commandline._completionList;
|
||||||
this.itemList.setItems(this.context);
|
this.itemList.setItems(this.context);
|
||||||
this.reset();
|
this.reset();
|
||||||
@@ -1162,8 +1163,6 @@ const CommandLine = Module("commandline", {
|
|||||||
|
|
||||||
get wildtype() this.wildtypes[this.wildIndex] || "",
|
get wildtype() this.wildtypes[this.wildIndex] || "",
|
||||||
|
|
||||||
get wildtypes() this.wildmode.values,
|
|
||||||
|
|
||||||
complete: function complete(show, tabPressed) {
|
complete: function complete(show, tabPressed) {
|
||||||
this.context.reset();
|
this.context.reset();
|
||||||
this.context.tabPressed = tabPressed;
|
this.context.tabPressed = tabPressed;
|
||||||
@@ -1331,20 +1330,20 @@ const CommandLine = Module("commandline", {
|
|||||||
|
|
||||||
tabs: [],
|
tabs: [],
|
||||||
|
|
||||||
tab: function tab(reverse) {
|
tab: function tab(reverse, wildmode) {
|
||||||
commandline._autocompleteTimer.flush();
|
commandline._autocompleteTimer.flush();
|
||||||
// Check if we need to run the completer.
|
// Check if we need to run the completer.
|
||||||
if (this.context.waitingForTab || this.wildIndex == -1)
|
if (this.context.waitingForTab || this.wildIndex == -1)
|
||||||
this.complete(true, true);
|
this.complete(true, true);
|
||||||
|
|
||||||
this.tabs.push(reverse);
|
this.tabs.push([reverse, wildmode || options.get("wildmode").values]);
|
||||||
if (this.waiting)
|
if (this.waiting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (this.tabs.length) {
|
while (this.tabs.length) {
|
||||||
this.wildIndex = Math.min(this.wildIndex, this.wildtypes.length - 1);
|
[reverse, this.wildtypes] = this.tabs.shift();
|
||||||
|
|
||||||
reverse = this.tabs.shift();
|
this.wildIndex = Math.min(this.wildIndex, this.wildtypes.length - 1);
|
||||||
switch (this.wildtype.replace(/.*:/, "")) {
|
switch (this.wildtype.replace(/.*:/, "")) {
|
||||||
case "":
|
case "":
|
||||||
this.select(0);
|
this.select(0);
|
||||||
|
|||||||
@@ -811,6 +811,32 @@ const Completion = Module("completion", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
options: function () {
|
options: function () {
|
||||||
|
let wildmode = {
|
||||||
|
completer: function (context) [
|
||||||
|
// Why do we need ""?
|
||||||
|
// Because its description is useful during completion. --Kris
|
||||||
|
["", "Complete only the first match"],
|
||||||
|
["full", "Complete the next full match"],
|
||||||
|
["longest", "Complete to longest common string"],
|
||||||
|
["list", "If more than one match, list all matches"],
|
||||||
|
["list:full", "List all and complete first match"],
|
||||||
|
["list:longest", "List all and complete common string"]
|
||||||
|
],
|
||||||
|
checkHas: function (value, val) {
|
||||||
|
let [first, second] = value.split(":", 2);
|
||||||
|
return first == val || second == val;
|
||||||
|
},
|
||||||
|
has: function () {
|
||||||
|
test = function (val) this.values.some(function (value) this.checkHas(value, val), this);
|
||||||
|
return Array.some(arguments, test, this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
options.add(["altwildmode", "awim"],
|
||||||
|
"Define how command line completion works when the Alt key is pressed",
|
||||||
|
"stringlist", "list:full",
|
||||||
|
wildmode);
|
||||||
|
|
||||||
options.add(["autocomplete", "au"],
|
options.add(["autocomplete", "au"],
|
||||||
"Automatically update the completion list on any key press",
|
"Automatically update the completion list on any key press",
|
||||||
"regexlist", ".*");
|
"regexlist", ".*");
|
||||||
@@ -836,26 +862,7 @@ const Completion = Module("completion", {
|
|||||||
options.add(["wildmode", "wim"],
|
options.add(["wildmode", "wim"],
|
||||||
"Define how command line completion works",
|
"Define how command line completion works",
|
||||||
"stringlist", "list:full",
|
"stringlist", "list:full",
|
||||||
{
|
wildmode);
|
||||||
completer: function (context) [
|
|
||||||
// Why do we need ""?
|
|
||||||
// Because its description is useful during completion. --Kris
|
|
||||||
["", "Complete only the first match"],
|
|
||||||
["full", "Complete the next full match"],
|
|
||||||
["longest", "Complete to longest common string"],
|
|
||||||
["list", "If more than one match, list all matches"],
|
|
||||||
["list:full", "List all and complete first match"],
|
|
||||||
["list:longest", "List all and complete common string"]
|
|
||||||
],
|
|
||||||
checkHas: function (value, val) {
|
|
||||||
let [first, second] = value.split(":", 2);
|
|
||||||
return first == val || second == val;
|
|
||||||
},
|
|
||||||
has: function () {
|
|
||||||
test = function (val) this.values.some(function (value) this.checkHas(value, val), this);
|
|
||||||
return Array.some(arguments, test, this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
options.add(["wildsort", "wis"],
|
options.add(["wildsort", "wis"],
|
||||||
"Regexp list of which contexts to sort",
|
"Regexp list of which contexts to sort",
|
||||||
|
|||||||
@@ -321,6 +321,18 @@
|
|||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<tags>'awim' 'altwildmode'</tags>
|
||||||
|
<spec>'altwildmode' 'awim'</spec>
|
||||||
|
<type>stringlist</type>
|
||||||
|
<default>list:full</default>
|
||||||
|
<description>
|
||||||
|
<p>
|
||||||
|
Like <o>wildmode</o>, but when the <k name="Alt"/> key is pressed.
|
||||||
|
</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<tags>'au' 'autocomplete'</tags>
|
<tags>'au' 'autocomplete'</tags>
|
||||||
<spec>'autocomplete' 'au'</spec>
|
<spec>'autocomplete' 'au'</spec>
|
||||||
@@ -1418,6 +1430,10 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
See also <o>altwildmode</o>.
|
||||||
|
</p>
|
||||||
|
|
||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
backspace.
|
backspace.
|
||||||
- Supports reverse incremental search.
|
- Supports reverse incremental search.
|
||||||
* Replaced 'focuscontent' with 'strictfocus'
|
* Replaced 'focuscontent' with 'strictfocus'
|
||||||
|
* Added 'altwildmode' and <A-Tab> commandline key binding
|
||||||
* Added 'banghist' option
|
* Added 'banghist' option
|
||||||
* gf now toggles between source and content view.
|
* gf now toggles between source and content view.
|
||||||
The | key binding has been removed.
|
The | key binding has been removed.
|
||||||
|
|||||||
Reference in New Issue
Block a user