1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 09:04:12 +01:00

Complete :bmarkgit diff properly

This commit is contained in:
Kris Maglione
2008-12-05 08:45:43 -05:00
parent d81fdddb7b
commit d5439d0bdc
3 changed files with 54 additions and 9 deletions

View File

@@ -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