mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-14 00:25:48 +01:00
Add -max argument to :bmarks. Fix :bmarks extra highlighting.
This commit is contained in:
@@ -317,7 +317,7 @@ function Bookmarks() //{{{
|
|||||||
"List or open multiple bookmarks",
|
"List or open multiple bookmarks",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
bookmarks.list(args.join(" "), args["-tags"] || [], args.bang);
|
bookmarks.list(args.join(" "), args["-tags"] || [], args.bang, args["-max"]);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
bang: true,
|
bang: true,
|
||||||
@@ -326,7 +326,8 @@ function Bookmarks() //{{{
|
|||||||
context.quote = null;
|
context.quote = null;
|
||||||
completion.bookmark(context, args["-tags"]);
|
completion.bookmark(context, args["-tags"]);
|
||||||
},
|
},
|
||||||
options: [[["-tags", "-T"], commands.OPTION_LIST, null, tags]]
|
options: [[["-tags", "-T"], commands.OPTION_LIST, null, tags],
|
||||||
|
[["-max", "-m"], commands.OPTION_INT]]
|
||||||
});
|
});
|
||||||
|
|
||||||
commands.add(["delbm[arks]"],
|
commands.add(["delbm[arks]"],
|
||||||
@@ -559,12 +560,12 @@ function Bookmarks() //{{{
|
|||||||
},
|
},
|
||||||
|
|
||||||
// if openItems is true, open the matching bookmarks items in tabs rather than display
|
// if openItems is true, open the matching bookmarks items in tabs rather than display
|
||||||
list: function list(filter, tags, openItems)
|
list: function list(filter, tags, openItems, maxItems)
|
||||||
{
|
{
|
||||||
if (!openItems)
|
if (!openItems)
|
||||||
return completion.listCompleter("bookmark", filter, tags);
|
return completion.listCompleter("bookmark", filter, maxItems, tags);
|
||||||
|
let items = completion.runCompleter("bookmark", filter, maxItems, tags);
|
||||||
|
|
||||||
let items = this.get(filter, tags, false);
|
|
||||||
if (items.length)
|
if (items.length)
|
||||||
return liberator.open(items.map(function (i) i.url), liberator.NEW_TAB);
|
return liberator.open(items.map(function (i) i.url), liberator.NEW_TAB);
|
||||||
|
|
||||||
@@ -807,8 +808,8 @@ function History() //{{{
|
|||||||
{
|
{
|
||||||
if (!openItems)
|
if (!openItems)
|
||||||
return completion.listCompleter("history", filter, maxItems);
|
return completion.listCompleter("history", filter, maxItems);
|
||||||
|
let items = completion.runCompleter("history", filter, maxItems);
|
||||||
|
|
||||||
var items = this.get({ searchTerms: filter }, maxItems);
|
|
||||||
if (items.length)
|
if (items.length)
|
||||||
return liberator.open([i[0] for each (i in items)], liberator.NEW_TAB);
|
return liberator.open([i[0] for each (i in items)], liberator.NEW_TAB);
|
||||||
|
|
||||||
|
|||||||
@@ -1019,19 +1019,21 @@ function Completion() //{{{
|
|||||||
},
|
},
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
_runCompleter: function _runCompleter(name, filter)
|
_runCompleter: function _runCompleter(name, filter, maxItems)
|
||||||
{
|
{
|
||||||
let context = CompletionContext(filter);
|
let context = CompletionContext(filter);
|
||||||
let res = context.fork.apply(context, ["run", 0, this, name].concat(Array.slice(arguments, 2)));
|
context.maxItems = maxItems;
|
||||||
|
let res = context.fork.apply(context, ["run", 0, this, name].concat(Array.slice(arguments, 3)));
|
||||||
if (res) // FIXME
|
if (res) // FIXME
|
||||||
return { items: res.map(function (i) ({ item: i })) };
|
return { items: res.map(function (i) ({ item: i })) };
|
||||||
context.wait(true);
|
context.wait(true);
|
||||||
return context.allItems;
|
return context.allItems;
|
||||||
},
|
},
|
||||||
|
|
||||||
runCompleter: function runCompleter(name, filter)
|
runCompleter: function runCompleter(name, filter, maxItems)
|
||||||
{
|
{
|
||||||
return this._runCompleter(name, filter).items.map(function (i) i.item);
|
return this._runCompleter.apply(this, Array.slice(arguments))
|
||||||
|
.items.map(function (i) i.item);
|
||||||
},
|
},
|
||||||
|
|
||||||
// cancel any ongoing search
|
// cancel any ongoing search
|
||||||
@@ -1122,16 +1124,17 @@ function Completion() //{{{
|
|||||||
listCompleter: function listCompleter(name, filter, maxItems)
|
listCompleter: function listCompleter(name, filter, maxItems)
|
||||||
{
|
{
|
||||||
let context = CompletionContext(filter || "");
|
let context = CompletionContext(filter || "");
|
||||||
context.fork.apply(context, ["list", 0, completion, name].concat(Array.slice(arguments, 2)));
|
|
||||||
context = context.contexts["/list"];
|
|
||||||
context.maxItems = maxItems;
|
context.maxItems = maxItems;
|
||||||
|
context.fork.apply(context, ["list", 0, completion, name].concat(Array.slice(arguments, 3)));
|
||||||
|
context = context.contexts["/list"];
|
||||||
context.wait();
|
context.wait();
|
||||||
|
|
||||||
let list = template.generic(
|
let list = template.generic(
|
||||||
<div highlight="Completions">
|
<div highlight="Completions">
|
||||||
{ template.completionRow(context.title, "CompTitle") }
|
{ template.completionRow(context.title, "CompTitle") }
|
||||||
{ template.map(context.items, function (item) context.createRow(item), null, 50) }
|
{ template.map(context.items, function (item) context.createRow(item), null, 100) }
|
||||||
</div>);
|
</div>);
|
||||||
|
commandline.clear();
|
||||||
commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
|
commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1150,6 +1153,7 @@ function Completion() //{{{
|
|||||||
context.format = bookmarks.format;
|
context.format = bookmarks.format;
|
||||||
context.completions = bookmarks.get(context.filter)
|
context.completions = bookmarks.get(context.filter)
|
||||||
context.filters = [];
|
context.filters = [];
|
||||||
|
liberator.dump(tags);
|
||||||
if (tags)
|
if (tags)
|
||||||
context.filters.push(function ({ item: item }) tags.every(function (tag) item.tags.indexOf(tag) > -1));
|
context.filters.push(function ({ item: item }) tags.every(function (tag) item.tags.indexOf(tag) > -1));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const template = {
|
|||||||
<span class="extra-info">
|
<span class="extra-info">
|
||||||
({
|
({
|
||||||
template.map(extra, function (e)
|
template.map(extra, function (e)
|
||||||
<>{e[0]}: <span class={e[2]}>{e[1]}</span></>,
|
<>{e[0]}: <span highlight={e[2]}>{e[1]}</span></>,
|
||||||
<> </>/* Non-breaking space */)
|
<> </>/* Non-breaking space */)
|
||||||
})
|
})
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ function CommandLine() //{{{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var compl = null;
|
let compl = null;
|
||||||
if (longest && completions.items.length > 1)
|
if (longest && completions.items.length > 1)
|
||||||
compl = completions.longestSubstring;
|
compl = completions.longestSubstring;
|
||||||
else if (full)
|
else if (full)
|
||||||
@@ -369,7 +369,7 @@ function CommandLine() //{{{
|
|||||||
* after interpolated data.
|
* after interpolated data.
|
||||||
*/
|
*/
|
||||||
XML.ignoreWhitespace = typeof str == "xml";
|
XML.ignoreWhitespace = typeof str == "xml";
|
||||||
var output = util.xmlToDom(<div class={"ex-command-output " + highlightGroup}>{template.maybeXML(str)}</div>, doc);
|
let output = util.xmlToDom(<div class={"ex-command-output " + highlightGroup}>{template.maybeXML(str)}</div>, doc);
|
||||||
XML.ignoreWhitespace = true;
|
XML.ignoreWhitespace = true;
|
||||||
|
|
||||||
lastMowOutput = output;
|
lastMowOutput = output;
|
||||||
@@ -386,7 +386,7 @@ function CommandLine() //{{{
|
|||||||
if (options["more"] && win.scrollMaxY > 0)
|
if (options["more"] && win.scrollMaxY > 0)
|
||||||
{
|
{
|
||||||
// start the last executed command's output at the top of the screen
|
// start the last executed command's output at the top of the screen
|
||||||
var elements = doc.getElementsByClassName("ex-command-output");
|
let elements = doc.getElementsByClassName("ex-command-output");
|
||||||
elements[elements.length - 1].scrollIntoView(true);
|
elements[elements.length - 1].scrollIntoView(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -721,7 +721,7 @@ function CommandLine() //{{{
|
|||||||
// normally used when pressing esc, does not execute a command
|
// normally used when pressing esc, does not execute a command
|
||||||
close: function close()
|
close: function close()
|
||||||
{
|
{
|
||||||
var res = liberator.triggerCallback("cancel", currentExtendedMode);
|
let res = liberator.triggerCallback("cancel", currentExtendedMode);
|
||||||
inputHistory.add(this.getCommand());
|
inputHistory.add(this.getCommand());
|
||||||
statusline.updateProgress(""); // we may have a "match x of y" visible
|
statusline.updateProgress(""); // we may have a "match x of y" visible
|
||||||
this.clear();
|
this.clear();
|
||||||
@@ -740,7 +740,7 @@ function CommandLine() //{{{
|
|||||||
// liberator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst
|
// liberator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst
|
||||||
echo: function echo(str, highlightGroup, flags)
|
echo: function echo(str, highlightGroup, flags)
|
||||||
{
|
{
|
||||||
var focused = document.commandDispatcher.focusedElement;
|
let focused = document.commandDispatcher.focusedElement;
|
||||||
if (focused && focused == commandWidget.inputField || focused == multilineInputWidget.inputField)
|
if (focused && focused == commandWidget.inputField || focused == multilineInputWidget.inputField)
|
||||||
return false;
|
return false;
|
||||||
if (silent)
|
if (silent)
|
||||||
@@ -751,32 +751,27 @@ function CommandLine() //{{{
|
|||||||
if (flags & this.APPEND_TO_MESSAGES)
|
if (flags & this.APPEND_TO_MESSAGES)
|
||||||
messageHistory.add({ str: str, highlight: highlightGroup });
|
messageHistory.add({ str: str, highlight: highlightGroup });
|
||||||
|
|
||||||
// if we are modifing the GUI while we are not in the main thread
|
liberator.callInMainThread(function () {
|
||||||
// Firefox will hang up
|
let where = setLine;
|
||||||
var threadManager = Components.classes["@mozilla.org/thread-manager;1"]
|
if (flags & this.FORCE_MULTILINE)
|
||||||
.getService(Components.interfaces.nsIThreadManager);
|
where = setMultiline;
|
||||||
if (!threadManager.isMainThread)
|
else if (flags & this.FORCE_SINGLELINE)
|
||||||
return false;
|
|
||||||
|
|
||||||
var where = setLine;
|
|
||||||
if (flags & this.FORCE_MULTILINE)
|
|
||||||
where = setMultiline;
|
|
||||||
else if (flags & this.FORCE_SINGLELINE)
|
|
||||||
where = function () setLine(str, highlightGroup, true);
|
|
||||||
else if (flags & this.DISALLOW_MULTILINE)
|
|
||||||
{
|
|
||||||
if (!outputContainer.collapsed)
|
|
||||||
where = null;
|
|
||||||
else
|
|
||||||
where = function () setLine(str, highlightGroup, true);
|
where = function () setLine(str, highlightGroup, true);
|
||||||
}
|
else if (flags & this.DISALLOW_MULTILINE)
|
||||||
else if (/\n|<br\/?>/.test(str))
|
{
|
||||||
where = setMultiline;
|
if (!outputContainer.collapsed)
|
||||||
|
where = null;
|
||||||
|
else
|
||||||
|
where = function () setLine(str, highlightGroup, true);
|
||||||
|
}
|
||||||
|
else if (/\n|<br\/?>/.test(str))
|
||||||
|
where = setMultiline;
|
||||||
|
|
||||||
if (where)
|
if (where)
|
||||||
where(str, highlightGroup);
|
where(str, highlightGroup);
|
||||||
|
|
||||||
currentExtendedMode = null;
|
currentExtendedMode = null;
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -857,7 +852,7 @@ function CommandLine() //{{{
|
|||||||
if (!currentExtendedMode)
|
if (!currentExtendedMode)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var key = events.toString(event);
|
let key = events.toString(event);
|
||||||
//liberator.log("command line handling key: " + key + "\n");
|
//liberator.log("command line handling key: " + key + "\n");
|
||||||
|
|
||||||
// user pressed ENTER to carry out a command
|
// user pressed ENTER to carry out a command
|
||||||
@@ -976,10 +971,10 @@ function CommandLine() //{{{
|
|||||||
{
|
{
|
||||||
if (event.type == "keypress")
|
if (event.type == "keypress")
|
||||||
{
|
{
|
||||||
var key = events.toString(event);
|
let key = events.toString(event);
|
||||||
if (events.isAcceptKey(key))
|
if (events.isAcceptKey(key))
|
||||||
{
|
{
|
||||||
var text = multilineInputWidget.value.substr(0, multilineInputWidget.selectionStart);
|
let text = multilineInputWidget.value.substr(0, multilineInputWidget.selectionStart);
|
||||||
if (text.match(multilineRegexp))
|
if (text.match(multilineRegexp))
|
||||||
{
|
{
|
||||||
text = text.replace(multilineRegexp, "");
|
text = text.replace(multilineRegexp, "");
|
||||||
@@ -1010,17 +1005,17 @@ function CommandLine() //{{{
|
|||||||
// allow a down motion after an up rather than closing
|
// allow a down motion after an up rather than closing
|
||||||
onMultilineOutputEvent: function onMultilineOutputEvent(event)
|
onMultilineOutputEvent: function onMultilineOutputEvent(event)
|
||||||
{
|
{
|
||||||
var win = multilineOutputWidget.contentWindow;
|
let win = multilineOutputWidget.contentWindow;
|
||||||
|
|
||||||
var showMoreHelpPrompt = false;
|
let showMoreHelpPrompt = false;
|
||||||
var showMorePrompt = false;
|
let showMorePrompt = false;
|
||||||
var closeWindow = false;
|
let closeWindow = false;
|
||||||
var passEvent = false;
|
let passEvent = false;
|
||||||
|
|
||||||
function isScrollable() !win.scrollMaxY == 0;
|
function isScrollable() !win.scrollMaxY == 0;
|
||||||
function atEnd() win.scrollY / win.scrollMaxY >= 1;
|
function atEnd() win.scrollY / win.scrollMaxY >= 1;
|
||||||
|
|
||||||
var key = events.toString(event);
|
let key = events.toString(event);
|
||||||
|
|
||||||
if (startHints)
|
if (startHints)
|
||||||
{
|
{
|
||||||
@@ -1095,7 +1090,7 @@ function CommandLine() //{{{
|
|||||||
case "<MiddleMouse>":
|
case "<MiddleMouse>":
|
||||||
if (event.originalTarget.localName.toLowerCase() == "a")
|
if (event.originalTarget.localName.toLowerCase() == "a")
|
||||||
{
|
{
|
||||||
var where = /\btabopen\b/.test(options["activate"]) ?
|
let where = /\btabopen\b/.test(options["activate"]) ?
|
||||||
liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB;
|
liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB;
|
||||||
liberator.open(event.originalTarget.textContent, where);
|
liberator.open(event.originalTarget.textContent, where);
|
||||||
}
|
}
|
||||||
@@ -1631,8 +1626,7 @@ function StatusLine() //{{{
|
|||||||
// make it even more vim-like
|
// make it even more vim-like
|
||||||
if (url == "about:blank")
|
if (url == "about:blank")
|
||||||
{
|
{
|
||||||
var title = buffer.title;
|
if (!buffer.title)
|
||||||
if (!title)
|
|
||||||
url = "[No Name]";
|
url = "[No Name]";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1643,8 +1637,8 @@ function StatusLine() //{{{
|
|||||||
// when session information is available, add [+] when we can go backwards
|
// when session information is available, add [+] when we can go backwards
|
||||||
if (config.name == "Vimperator")
|
if (config.name == "Vimperator")
|
||||||
{
|
{
|
||||||
var sh = getWebNavigation().sessionHistory;
|
let sh = getWebNavigation().sessionHistory;
|
||||||
var modified = "";
|
let modified = "";
|
||||||
if (sh.index > 0)
|
if (sh.index > 0)
|
||||||
modified += "+";
|
modified += "+";
|
||||||
if (sh.index < sh.count -1)
|
if (sh.index < sh.count -1)
|
||||||
@@ -1679,7 +1673,7 @@ function StatusLine() //{{{
|
|||||||
}
|
}
|
||||||
else if (typeof progress == "number")
|
else if (typeof progress == "number")
|
||||||
{
|
{
|
||||||
var progressStr = "";
|
let progressStr = "";
|
||||||
if (progress <= 0)
|
if (progress <= 0)
|
||||||
progressStr = "[ Loading... ]";
|
progressStr = "[ Loading... ]";
|
||||||
else if (progress < 1)
|
else if (progress < 1)
|
||||||
@@ -1726,13 +1720,13 @@ function StatusLine() //{{{
|
|||||||
{
|
{
|
||||||
if (!percent || typeof percent != "number")
|
if (!percent || typeof percent != "number")
|
||||||
{
|
{
|
||||||
var win = document.commandDispatcher.focusedWindow;
|
let win = document.commandDispatcher.focusedWindow;
|
||||||
if (!win)
|
if (!win)
|
||||||
return;
|
return;
|
||||||
percent = win.scrollMaxY == 0 ? -1 : win.scrollY / win.scrollMaxY;
|
percent = win.scrollMaxY == 0 ? -1 : win.scrollY / win.scrollMaxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bufferPositionStr = "";
|
let bufferPositionStr = "";
|
||||||
percent = Math.round(percent * 100);
|
percent = Math.round(percent * 100);
|
||||||
if (percent < 0)
|
if (percent < 0)
|
||||||
bufferPositionStr = "All";
|
bufferPositionStr = "All";
|
||||||
|
|||||||
Reference in New Issue
Block a user