mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 10:08:00 +01:00
More completion stuff. Add proper :bmarks completion
This commit is contained in:
@@ -78,13 +78,7 @@ function Bookmarks() //{{{
|
||||
let tags = taggingService.getTagsForURI(uri, {}) || [];
|
||||
//return bookmarks.push(new Bookmark(node.uri, node.title, null, keyword, tags, node.itemId));
|
||||
|
||||
return bookmarks.push({ url: node.uri,
|
||||
title: node.title,
|
||||
get icon() getFavicon(node.uri), // TODO; must be a direct way to get the icon
|
||||
keyword: keyword,
|
||||
tags: tags,
|
||||
id: node.itemId,
|
||||
get xml() template.bookmarkItem(this)});
|
||||
return bookmarks.push(new Bookmark(node.uri, node.title, null, keyword, tags, node.itemId));
|
||||
}
|
||||
|
||||
function readBookmark(id)
|
||||
@@ -287,6 +281,9 @@ function Bookmarks() //{{{
|
||||
},
|
||||
{ argCount: "0" });
|
||||
|
||||
function tags() util.Array.uniq(util.Array.flatten([b.tags for ([k, b] in Iterator(cache.bookmarks))]))
|
||||
.map(function (tag) [tag, tag]);
|
||||
|
||||
commands.add(["bma[rk]"],
|
||||
"Add a bookmark",
|
||||
function (args, special)
|
||||
@@ -322,8 +319,14 @@ function Bookmarks() //{{{
|
||||
},
|
||||
{
|
||||
bang: true,
|
||||
completer: function (context) completion.bookmark(context.filter),
|
||||
options: [[["-tags", "-T"], commands.OPTION_LIST]]
|
||||
completer: function (context, args)
|
||||
{
|
||||
if (args.completeOpt)
|
||||
return;
|
||||
context.advance(args.completeStart); // TODO: Move this to completion.ex?
|
||||
completion.url(context, "b");
|
||||
},
|
||||
options: [[["-tags", "-T"], commands.OPTION_LIST, null, tags]]
|
||||
});
|
||||
|
||||
commands.add(["delbm[arks]"],
|
||||
|
||||
@@ -534,7 +534,7 @@ function Commands() //{{{
|
||||
|
||||
if (complete)
|
||||
{
|
||||
if (quote || !invalid && count)
|
||||
if (quote || !invalid && count && i + optname.length + 1 + arg.length == str.length)
|
||||
{
|
||||
args.completeStart += optname.length + 1;
|
||||
args.completeOpt = opt[0][0];
|
||||
|
||||
@@ -266,9 +266,9 @@ function Completion() //{{{
|
||||
|
||||
completion.filterMap = [null, function (v) template.highlight(v, true)];
|
||||
|
||||
if (cacheFilter.js === cacheKey)
|
||||
return cacheResults.js;
|
||||
cacheFilter.js = cacheKey;
|
||||
//if (cacheFilter.js === cacheKey)
|
||||
// return cacheResults.js;
|
||||
//cacheFilter.js = cacheKey;
|
||||
|
||||
// Can't use the cache. Build a member list.
|
||||
compl = [];
|
||||
|
||||
@@ -1344,7 +1344,7 @@ function ItemList(id) //{{{
|
||||
function fill(offset)
|
||||
{
|
||||
let diff = offset - startIndex;
|
||||
if (items == null || offset == null || offset - startIndex == 0 || offset < 0)
|
||||
if (items == null || offset == null || diff == 0 || offset < 0)
|
||||
return;
|
||||
|
||||
startIndex = offset;
|
||||
|
||||
Reference in New Issue
Block a user