mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-16 11:45:46 +01:00
Complete :bmarkgit diff properly
This commit is contained in:
@@ -143,7 +143,7 @@ Command.prototype = {
|
||||
return false;
|
||||
},
|
||||
|
||||
parseArgs: function (args, complete) commands.parseArgs(args, this.options, this.argCount, false, this.literal, complete)
|
||||
parseArgs: function (args, complete, extra) commands.parseArgs(args, this.options, this.argCount, false, this.literal, complete, extra)
|
||||
|
||||
}; //}}}
|
||||
|
||||
@@ -319,7 +319,7 @@ function Commands() //{{{
|
||||
// @param allowUnknownOptions: -foo won't result in an error, if -foo isn't
|
||||
// specified in "options"
|
||||
// TODO: should it handle comments?
|
||||
parseArgs: function (str, options, argCount, allowUnknownOptions, literal, complete)
|
||||
parseArgs: function (str, options, argCount, allowUnknownOptions, literal, complete, extra)
|
||||
{
|
||||
// returns [count, parsed_argument]
|
||||
function getNextArg(str)
|
||||
@@ -421,6 +421,10 @@ function Commands() //{{{
|
||||
args.string = str; // for access to the unparsed string
|
||||
args.literalArg = "";
|
||||
|
||||
// FIXME!
|
||||
for (let [k, v] in Iterator(extra || []))
|
||||
args[k] = v;
|
||||
|
||||
var invalid = false;
|
||||
// FIXME: best way to specify these requirements?
|
||||
var onlyArgumentsRemaining = allowUnknownOptions || options.length == 0 || false; // after a -- has been found
|
||||
|
||||
@@ -452,9 +452,9 @@ CompletionContext.prototype = {
|
||||
catch (e) {}
|
||||
},
|
||||
|
||||
match: function match(str)
|
||||
// FIXME
|
||||
_match: function _match(filter, str)
|
||||
{
|
||||
let filter = this.filter;
|
||||
if (this.ignoreCase)
|
||||
{
|
||||
filter = filter.toLowerCase();
|
||||
@@ -465,6 +465,11 @@ CompletionContext.prototype = {
|
||||
return str.indexOf(filter) > -1;
|
||||
},
|
||||
|
||||
match: function match(str)
|
||||
{
|
||||
return this._match(this.filter, str);
|
||||
},
|
||||
|
||||
reset: function reset()
|
||||
{
|
||||
let self = this;
|
||||
@@ -1172,10 +1177,16 @@ function Completion() //{{{
|
||||
context.completions = config.autocommands;
|
||||
},
|
||||
|
||||
bookmark: function bookmark(context, tags)
|
||||
bookmark: function bookmark(context, tags, extra)
|
||||
{
|
||||
context.title = ["Bookmark", "Title"];
|
||||
context.format = bookmarks.format;
|
||||
for (let val in Iterator(extra || []))
|
||||
{
|
||||
let [k, v] = val; // Need let block here for closure.
|
||||
if (v)
|
||||
context.filters.push(function (item) this._match(v, this.getKey(item, k)));
|
||||
}
|
||||
// Need to make a copy because set completions() checks instanceof Array,
|
||||
// and this may be an Array from another window.
|
||||
context.completions = Array.slice(storage["bookmark-cache"].bookmarks);
|
||||
@@ -1279,7 +1290,7 @@ function Completion() //{{{
|
||||
[prefix] = context.filter.match(/^(?:\w*[\s!]|!)\s*/);
|
||||
let cmdContext = context.fork(cmd, prefix.length);
|
||||
let argContext = context.fork("args", prefix.length);
|
||||
args = command.parseArgs(cmdContext.filter, argContext);
|
||||
args = command.parseArgs(cmdContext.filter, argContext, { count: count, bang: bang });
|
||||
if (args)
|
||||
{
|
||||
// FIXME: Move to parseCommand
|
||||
|
||||
Reference in New Issue
Block a user