mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-23 08:33:32 +01:00
Better :qmark completion.
This commit is contained in:
@@ -46,6 +46,14 @@ const QuickMarks = Module("quickmarks", {
|
|||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the URL of the given QuickMark, or null if none exists.
|
||||||
|
*
|
||||||
|
* @param {string} mark The mark to find.
|
||||||
|
* @returns {string} The mark's URL.
|
||||||
|
*/
|
||||||
|
get: function (mark) this._qmarks.get(mark) || null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the specified quickmarks. The <b>filter</b> is a list of
|
* Deletes the specified quickmarks. The <b>filter</b> is a list of
|
||||||
* quickmarks and ranges are supported. Eg. "ab c d e-k".
|
* quickmarks and ranges are supported. Eg. "ab c d e-k".
|
||||||
@@ -77,7 +85,7 @@ const QuickMarks = Module("quickmarks", {
|
|||||||
* URL. See {@link Dactyl#open}.
|
* URL. See {@link Dactyl#open}.
|
||||||
*/
|
*/
|
||||||
jumpTo: function jumpTo(qmark, where) {
|
jumpTo: function jumpTo(qmark, where) {
|
||||||
let url = this._qmarks.get(qmark);
|
let url = this.get(qmark);
|
||||||
|
|
||||||
if (url)
|
if (url)
|
||||||
dactyl.open(url, where);
|
dactyl.open(url, where);
|
||||||
@@ -148,8 +156,17 @@ const QuickMarks = Module("quickmarks", {
|
|||||||
{
|
{
|
||||||
argCount: "+",
|
argCount: "+",
|
||||||
completer: function (context, args) {
|
completer: function (context, args) {
|
||||||
if (args.length == 2)
|
if (args.length == 1)
|
||||||
return completion.url(context);
|
return completion.quickmark(context);
|
||||||
|
if (args.length == 2) {
|
||||||
|
context.fork("current", 0, this, function (context) {
|
||||||
|
context.title = ["Extra Completions"];
|
||||||
|
context.completions = [
|
||||||
|
[quickmarks.get(args[0]), "Current Value"]
|
||||||
|
].filter(function ([k, v]) k);
|
||||||
|
});
|
||||||
|
context.fork("url", 0, completion, "url");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
literal: 1
|
literal: 1
|
||||||
});
|
});
|
||||||
@@ -168,6 +185,12 @@ const QuickMarks = Module("quickmarks", {
|
|||||||
literal: 0
|
literal: 0
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
completion: function () {
|
||||||
|
completion.quickmark = function (context) {
|
||||||
|
context.title = ["QuickMark", "URL"];
|
||||||
|
context.generate = function () Iterator(quickmarks._qmarks);
|
||||||
|
}
|
||||||
|
},
|
||||||
mappings: function () {
|
mappings: function () {
|
||||||
var myModes = config.browserModes;
|
var myModes = config.browserModes;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user