mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 07:08:00 +01:00
Speed up completions. Fix Structcommands.jsdefaultValue in FF 3.0. Temporarilly name anonymous functions for profiling.
This commit is contained in:
@@ -853,8 +853,9 @@ function Commands() //{{{
|
||||
bang: true,
|
||||
// Yeah, this is a bit scary. Perhaps I'll fix it when I'm
|
||||
// awake.
|
||||
options: util.Array.assocToObj(util.map({argCount: "-nargs", bang: "-bang", count: "-count"},
|
||||
function ([k, v]) k in cmd && cmd[k] != "0" && [v, typeof cmd[k] == "boolean" ? null : cmd[k]])
|
||||
options: util.Array.assocToObj(
|
||||
util.map({argCount: "-nargs", bang: "-bang", count: "-count"},
|
||||
function ([k, v]) k in cmd && cmd[k] != "0" && [v, typeof cmd[k] == "boolean" ? null : cmd[k]])
|
||||
.filter(function (k) k)),
|
||||
arguments: [cmd.name],
|
||||
literalArg: cmd.replacementText
|
||||
|
||||
@@ -27,7 +27,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
||||
}}} ***** END LICENSE BLOCK *****/
|
||||
|
||||
// An eval with a cleaner lexical scope.
|
||||
modules._cleanEval = function (__liberator_eval_arg, __liberator_eval_tmp)
|
||||
modules._cleanEval = function _cleanEval(__liberator_eval_arg, __liberator_eval_tmp)
|
||||
{
|
||||
return window.eval(__liberator_eval_arg);
|
||||
}
|
||||
@@ -54,6 +54,7 @@ function CompletionContext(editor, name, offset)
|
||||
this.offset = parent.offset + (offset || 0);
|
||||
this.__defineGetter__("tabPressed", function () this.parent.tabPressed);
|
||||
this.__defineGetter__("onUpdate", function () this.parent.onUpdate);
|
||||
this.__defineGetter__("updateAsync", function () this.parent.updateAsync);
|
||||
this.__defineGetter__("value", function () this.parent.value);
|
||||
this.__defineGetter__("selectionTypes", function () this.parent.selectionTypes);
|
||||
this.incomplete = false;
|
||||
@@ -114,18 +115,19 @@ CompletionContext.prototype = {
|
||||
{
|
||||
this.hasItems = items.length > 0;
|
||||
this._items = items;
|
||||
this.onUpdate.call(this);
|
||||
if (this.updateAsync)
|
||||
this.onUpdate.call(this);
|
||||
},
|
||||
|
||||
get title() this._title || ["Completions"], // XXX
|
||||
set title(val) this._title = val,
|
||||
|
||||
advance: function (count)
|
||||
advance: function advance(count)
|
||||
{
|
||||
this.offset += count;
|
||||
},
|
||||
|
||||
fork: function (name, offset, completer, self)
|
||||
fork: function fork(name, offset, completer, self)
|
||||
{
|
||||
let context = new CompletionContext(this, name, offset);
|
||||
if (completer)
|
||||
@@ -133,7 +135,7 @@ CompletionContext.prototype = {
|
||||
return context;
|
||||
},
|
||||
|
||||
highlight: function (start, length, type)
|
||||
highlight: function highlight(start, length, type)
|
||||
{
|
||||
try // Firefox <3.1 doesn't have repaintSelection
|
||||
{
|
||||
@@ -157,7 +159,7 @@ CompletionContext.prototype = {
|
||||
catch (e) {}
|
||||
},
|
||||
|
||||
reset: function ()
|
||||
reset: function reset()
|
||||
{
|
||||
let self = this;
|
||||
if (this.parent)
|
||||
@@ -165,6 +167,7 @@ CompletionContext.prototype = {
|
||||
// Not ideal.
|
||||
for (let type in this.selectionTypes)
|
||||
this.highlight(0, 0, type);
|
||||
this.updateAsync = false;
|
||||
this.selectionTypes = {};
|
||||
this.tabPressed = false;
|
||||
this.offset = 0;
|
||||
@@ -269,7 +272,7 @@ function Completion() //{{{
|
||||
if (!(objects instanceof Array))
|
||||
objects = [objects];
|
||||
|
||||
completion.filterMap = [null, function (v) template.highlight(v, true)];
|
||||
completion.filterMap = [null, function highlight(v) template.highlight(v, true)];
|
||||
|
||||
let [obj, key] = objects;
|
||||
let cache = this.context.cache.objects || {};
|
||||
@@ -485,7 +488,7 @@ function Completion() //{{{
|
||||
lastIdx = i;
|
||||
}
|
||||
|
||||
this.complete = function (context)
|
||||
this.complete = function _complete(context)
|
||||
{
|
||||
this.context = context;
|
||||
let string = context.filter;
|
||||
@@ -787,13 +790,13 @@ function Completion() //{{{
|
||||
|
||||
return {
|
||||
|
||||
setFunctionCompleter: function (funcs, completers)
|
||||
setFunctionCompleter: function setFunctionCompleter(funcs, completers)
|
||||
{
|
||||
if (!(funcs instanceof Array))
|
||||
funcs = [funcs];
|
||||
for (let [,func] in Iterator(funcs))
|
||||
{
|
||||
func.liberatorCompleter = function (func, obj, string, args) {
|
||||
func.liberatorCompleter = function liberatorCompleter(func, obj, string, args) {
|
||||
let completer = completers[args.length - 1];
|
||||
if (!completer)
|
||||
return [];
|
||||
@@ -834,7 +837,7 @@ function Completion() //{{{
|
||||
},
|
||||
|
||||
// cancel any ongoing search
|
||||
cancel: function()
|
||||
cancel: function cancel()
|
||||
{
|
||||
if (completionService)
|
||||
completionService.stopSearch();
|
||||
@@ -936,7 +939,7 @@ function Completion() //{{{
|
||||
|
||||
autocmdEvent: function autocmdEvent(filter) [0, this.filter(config.autocommands, filter)],
|
||||
|
||||
bookmark: function (filter)
|
||||
bookmark: function bookmark(filter)
|
||||
{
|
||||
return {
|
||||
start: 0,
|
||||
@@ -1033,7 +1036,7 @@ function Completion() //{{{
|
||||
|
||||
dialog: function dialog(filter) [0, this.filter(config.dialogs, filter)],
|
||||
|
||||
directory: function (context, tail)
|
||||
directory: function directory(context, tail)
|
||||
{
|
||||
this.file(context, tail);
|
||||
context.items = context.items.filter(function (i) i[1] == "Directory");
|
||||
@@ -1081,25 +1084,26 @@ function Completion() //{{{
|
||||
if (command)
|
||||
{
|
||||
[prefix] = context.filter.match(/^(?:\w*[\s!]|!)\s*/);
|
||||
context = context.fork(cmd, prefix.length);
|
||||
let argContext = context.fork("args", args.completeStart);
|
||||
args = command.parseArgs(context.filter, argContext);
|
||||
let cmdContext = context.fork(cmd, prefix.length);
|
||||
let argContext = cmdContext.fork("args", args.completeStart);
|
||||
args = command.parseArgs(cmdContext.filter, argContext);
|
||||
if (args)
|
||||
{
|
||||
// XXX, XXX, XXX
|
||||
if (!args.completeOpt && command.completer)
|
||||
{
|
||||
context.advance(args.completeStart);
|
||||
compObject = command.completer.call(command, context, args, special, count);
|
||||
cmdContext.advance(args.completeStart);
|
||||
compObject = command.completer.call(command, cmdContext, args, special, count);
|
||||
if (compObject instanceof Array) // for now at least, let completion functions return arrays instead of objects
|
||||
compObject = { start: compObject[0], items: compObject[1] };
|
||||
if (compObject != null)
|
||||
{
|
||||
context.advance(compObject.start);
|
||||
context.title = ["Completions"];
|
||||
context.items = compObject.items;
|
||||
cmdContext.advance(compObject.start);
|
||||
cmdContext.title = ["Completions"];
|
||||
cmdContext.items = compObject.items;
|
||||
}
|
||||
}
|
||||
cmdContext.updateAsync = true;
|
||||
}
|
||||
//liberator.dump([[v.name, v.offset, v.items.length, v.hasItems] for each (v in context.contexts)]);
|
||||
}
|
||||
@@ -1112,7 +1116,7 @@ function Completion() //{{{
|
||||
let [dir] = context.filter.match(/^(?:.*[\/\\])?/);
|
||||
// dir == "" is expanded inside readDirectory to the current dir
|
||||
|
||||
let generate = function ()
|
||||
let generate = function generate()
|
||||
{
|
||||
let files = [], mapped = [];
|
||||
|
||||
@@ -1173,7 +1177,7 @@ function Completion() //{{{
|
||||
|
||||
get javascriptCompleter() javascript,
|
||||
|
||||
javascript: function (context)
|
||||
javascript: function _javascript(context)
|
||||
{
|
||||
return javascript.complete(context);
|
||||
},
|
||||
@@ -1229,7 +1233,7 @@ function Completion() //{{{
|
||||
},
|
||||
|
||||
// XXX: Move to bookmarks.js?
|
||||
searchEngineSuggest: function (context, engineAliases)
|
||||
searchEngineSuggest: function searchEngineSuggest(context, engineAliases)
|
||||
{
|
||||
if (!filter)
|
||||
return [0, []];
|
||||
@@ -1273,7 +1277,7 @@ function Completion() //{{{
|
||||
|
||||
shellCommand: function shellCommand(filter)
|
||||
{
|
||||
let generate = function ()
|
||||
let generate = function generate()
|
||||
{
|
||||
const environmentService = Components.classes["@mozilla.org/process/environment;1"]
|
||||
.getService(Components.interfaces.nsIEnvironment);
|
||||
@@ -1345,10 +1349,10 @@ function Completion() //{{{
|
||||
s: this.search,
|
||||
f: this.file,
|
||||
S: this.searchEngineSuggest,
|
||||
b: function (context)
|
||||
b: function b(context)
|
||||
{
|
||||
context.title = ["Bookmark", "Title"];
|
||||
context.createRow = function (context, item, class)
|
||||
context.createRow = function createRow(context, item, class)
|
||||
{
|
||||
// FIXME
|
||||
if (class)
|
||||
@@ -1357,7 +1361,7 @@ function Completion() //{{{
|
||||
}
|
||||
context.items = bookmarks.get(context.filter)
|
||||
},
|
||||
l: function (context)
|
||||
l: function l(context)
|
||||
{
|
||||
if (!completionService)
|
||||
return
|
||||
@@ -1392,7 +1396,7 @@ function Completion() //{{{
|
||||
},
|
||||
|
||||
// FIXME: Temporary
|
||||
_url: function (filter, complete)
|
||||
_url: function _url(filter, complete)
|
||||
{
|
||||
let context = new CompletionContext(filter);
|
||||
this.url(context, complete);
|
||||
|
||||
@@ -166,8 +166,7 @@ function Editor() //{{{
|
||||
"Abbreviate a key sequence" + modeDescription,
|
||||
function (args)
|
||||
{
|
||||
let lhs = args.arguments[0];
|
||||
let rhs = args.literalArg;
|
||||
let [lhs, rhs] = args.arguments;
|
||||
if (rhs)
|
||||
editor.addAbbreviation(mode, lhs, rhs);
|
||||
else
|
||||
|
||||
@@ -72,8 +72,7 @@ function AutoCommands() //{{{
|
||||
"Execute commands automatically on events",
|
||||
function (args, special)
|
||||
{
|
||||
let [event, regex] = args.arguments;
|
||||
let cmd = args.literalArg;
|
||||
let [event, regex, cmd] = args.arguments;
|
||||
let events = null;
|
||||
if (event)
|
||||
{
|
||||
|
||||
@@ -158,8 +158,7 @@ function Mappings() //{{{
|
||||
}
|
||||
|
||||
// ?:\s+ <- don't remember; (...)? optional = rhs
|
||||
let [lhs] = args.arguments;
|
||||
let rhs = args.literalArg;
|
||||
let [lhs, rhs] = args.arguments;
|
||||
|
||||
if (!rhs) // list the mapping
|
||||
{
|
||||
|
||||
@@ -128,7 +128,6 @@ function Highlights(name, store, serial)
|
||||
.replace(";!important;", ";", "g"); // Seeming Spidermonkey bug
|
||||
css = style.selector + " { " + css + " }";
|
||||
|
||||
style.filter; // FIXME: needed for FF 3.0 (not 3.1) - track down when I'm awake...
|
||||
let error = styles.addSheet(style.selector, style.filter, css, true, force);
|
||||
if (!error)
|
||||
style.value = newStyle;
|
||||
@@ -396,9 +395,8 @@ liberator.registerObserver("load_commands", function ()
|
||||
"Add or list user styles",
|
||||
function (args, special)
|
||||
{
|
||||
let [filter] = args.arguments;
|
||||
let [filter, css] = args.arguments;
|
||||
let name = args["-name"];
|
||||
let css = args.literalArg;
|
||||
|
||||
if (!css)
|
||||
{
|
||||
@@ -491,8 +489,7 @@ liberator.registerObserver("load_commands", function ()
|
||||
height: 1em !important; min-height: 1em !important; max-height: 1em !important;
|
||||
overflow: hidden !important;
|
||||
]]>;
|
||||
let key = args.arguments[0];
|
||||
let css = args.literalArg;
|
||||
let [key, css] = args.arguments[0];
|
||||
if (!css && !(key && special))
|
||||
{
|
||||
let str = template.tabular(["Key", "Sample", "CSS"],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const template = {
|
||||
add: function (a, b) a + b,
|
||||
join: function (c) function (a, b) a + c + b,
|
||||
add: function add(a, b) a + b,
|
||||
join: function join(c) function (a, b) a + c + b,
|
||||
|
||||
map: function (iter, fn, sep)
|
||||
map: function map(iter, fn, sep)
|
||||
{
|
||||
if (iter.length) /* Kludge? */
|
||||
iter = util.Array.iterator(iter);
|
||||
@@ -20,7 +20,7 @@ const template = {
|
||||
return ret;
|
||||
},
|
||||
|
||||
maybeXML: function (xml)
|
||||
maybeXML: function maybeXML(xml)
|
||||
{
|
||||
if (typeof xml == "xml")
|
||||
return xml;
|
||||
@@ -32,7 +32,7 @@ const template = {
|
||||
return <>{xml}</>;
|
||||
},
|
||||
|
||||
completionRow: function (context, item, class)
|
||||
completionRow: function completionRow(context, item, class)
|
||||
{
|
||||
let text = item.text || item[0] || "";
|
||||
let description = item.description || item[1] || "";
|
||||
@@ -66,7 +66,7 @@ const template = {
|
||||
|
||||
// if "processStrings" is true, any passed strings will be surrounded by " and
|
||||
// any line breaks are displayed as \n
|
||||
highlight: function (arg, processStrings)
|
||||
highlight: function highlight(arg, processStrings)
|
||||
{
|
||||
// some objects like window.JSON or getBrowsers()._browsers need the try/catch
|
||||
try
|
||||
@@ -107,7 +107,7 @@ const template = {
|
||||
}
|
||||
},
|
||||
|
||||
highlightFilter: function (str, filter)
|
||||
highlightFilter: function highlightFilter(str, filter)
|
||||
{
|
||||
if (typeof str == "xml")
|
||||
return str;
|
||||
@@ -125,7 +125,7 @@ const template = {
|
||||
})());
|
||||
},
|
||||
|
||||
highlightRegexp: function (str, re)
|
||||
highlightRegexp: function highlightRegexp(str, re)
|
||||
{
|
||||
if (typeof str == "xml")
|
||||
return str;
|
||||
@@ -137,7 +137,7 @@ const template = {
|
||||
})());
|
||||
},
|
||||
|
||||
highlightSubstrings: function (str, iter)
|
||||
highlightSubstrings: function highlightSubstrings(str, iter)
|
||||
{
|
||||
if (typeof str == "xml")
|
||||
return str;
|
||||
@@ -157,7 +157,7 @@ const template = {
|
||||
return s + <>{str.substr(start)}</>;
|
||||
},
|
||||
|
||||
highlightURL: function (str, force)
|
||||
highlightURL: function highlightURL(str, force)
|
||||
{
|
||||
if (force || /^[a-zA-Z]+:\/\//.test(str))
|
||||
return <a class="hl-URL" href="#">{str}</a>;
|
||||
@@ -165,14 +165,14 @@ const template = {
|
||||
return str;
|
||||
},
|
||||
|
||||
generic: function (xml)
|
||||
generic: function generic(xml)
|
||||
{
|
||||
return <>:{commandline.getCommand()}<br/></> + xml;
|
||||
},
|
||||
|
||||
// every item must have a .xml property which defines how to draw itself
|
||||
// @param headers is an array of strings, the text for the header columns
|
||||
genericTable: function (headers, items)
|
||||
genericTable: function genericTable(headers, items)
|
||||
{
|
||||
return this.generic(
|
||||
<table>
|
||||
@@ -188,7 +188,7 @@ const template = {
|
||||
},
|
||||
|
||||
// returns a single row for a bookmark or history item
|
||||
bookmarkItem: function (item)
|
||||
bookmarkItem: function bookmarkItem(item)
|
||||
{
|
||||
var extra = [];
|
||||
if (item.keyword)
|
||||
@@ -215,7 +215,7 @@ const template = {
|
||||
</ul>
|
||||
},
|
||||
|
||||
jumps: function (index, elems)
|
||||
jumps: function jumps(index, elems)
|
||||
{
|
||||
return this.generic(
|
||||
<table>
|
||||
@@ -234,7 +234,7 @@ const template = {
|
||||
</table>);
|
||||
},
|
||||
|
||||
options: function (title, opts)
|
||||
options: function options(title, opts)
|
||||
{
|
||||
return this.generic(
|
||||
<table>
|
||||
@@ -253,7 +253,7 @@ const template = {
|
||||
</table>);
|
||||
},
|
||||
|
||||
table: function (title, data, indent)
|
||||
table: function table(title, data, indent)
|
||||
{
|
||||
let table =
|
||||
<table>
|
||||
@@ -272,7 +272,7 @@ const template = {
|
||||
return table;
|
||||
},
|
||||
|
||||
tabular: function (headings, style, iter)
|
||||
tabular: function tabular(headings, style, iter)
|
||||
{
|
||||
/* This might be mind-bogglingly slow. We'll see. */
|
||||
return this.generic(
|
||||
@@ -295,7 +295,7 @@ const template = {
|
||||
</table>);
|
||||
},
|
||||
|
||||
usage: function (iter)
|
||||
usage: function usage(iter)
|
||||
{
|
||||
return this.generic(
|
||||
<table>
|
||||
|
||||
@@ -50,9 +50,9 @@ function CommandLine() //{{{
|
||||
|
||||
get length() this.store.length,
|
||||
|
||||
get: function (index) this.store.get(index),
|
||||
get: function get(index) this.store.get(index),
|
||||
|
||||
add: function (str)
|
||||
add: function add(str)
|
||||
{
|
||||
if (!str)
|
||||
return;
|
||||
@@ -81,7 +81,7 @@ function CommandLine() //{{{
|
||||
|
||||
get length() this._messages.length,
|
||||
|
||||
add: function (message)
|
||||
add: function add(message)
|
||||
{
|
||||
if (!message)
|
||||
return;
|
||||
@@ -316,7 +316,7 @@ function CommandLine() //{{{
|
||||
"Items which are completed at the :[tab]open prompt",
|
||||
"charlist", "sfl",
|
||||
{
|
||||
completer: function (filter)
|
||||
completer: function completer(filter)
|
||||
{
|
||||
return [
|
||||
["s", "Search engines and keyword URLs"],
|
||||
@@ -327,7 +327,7 @@ function CommandLine() //{{{
|
||||
["S", "Suggest engines"]
|
||||
];
|
||||
},
|
||||
validator: function (value) !/[^sfbhSl]/.test(value)
|
||||
validator: function validator(value) !/[^sfbhSl]/.test(value)
|
||||
});
|
||||
|
||||
options.add(["history", "hi"],
|
||||
@@ -352,7 +352,7 @@ function CommandLine() //{{{
|
||||
"Engine Alias which has a feature of suggest",
|
||||
"stringlist", "google",
|
||||
{
|
||||
completer: function (value)
|
||||
completer: function completer(value)
|
||||
{
|
||||
let ss = Components.classes["@mozilla.org/browser/search-service;1"]
|
||||
.getService(Components.interfaces.nsIBrowserSearchService);
|
||||
@@ -361,7 +361,7 @@ function CommandLine() //{{{
|
||||
|
||||
return engines.map(function (engine) [engine.alias, engine.description]);
|
||||
},
|
||||
validator: function (value)
|
||||
validator: function validator(value)
|
||||
{
|
||||
let ss = Components.classes["@mozilla.org/browser/search-service;1"]
|
||||
.getService(Components.interfaces.nsIBrowserSearchService);
|
||||
@@ -377,7 +377,7 @@ function CommandLine() //{{{
|
||||
"List of file patterns to ignore when completing files",
|
||||
"stringlist", "",
|
||||
{
|
||||
validator: function (value)
|
||||
validator: function validator(value)
|
||||
{
|
||||
// TODO: allow for escaping the ","
|
||||
try
|
||||
@@ -396,7 +396,7 @@ function CommandLine() //{{{
|
||||
"Define how command line completion works",
|
||||
"stringlist", "list:full",
|
||||
{
|
||||
completer: function (filter)
|
||||
completer: function completer(filter)
|
||||
{
|
||||
return [
|
||||
["", "Complete only the first match"],
|
||||
@@ -407,7 +407,7 @@ function CommandLine() //{{{
|
||||
["list:longest", "List all and complete common string"]
|
||||
];
|
||||
},
|
||||
validator: function (value)
|
||||
validator: function validator(value)
|
||||
{
|
||||
return value.split(",").every(
|
||||
function (item) /^(full|longest|list|list:full|list:longest|)$/.test(item)
|
||||
@@ -419,14 +419,14 @@ function CommandLine() //{{{
|
||||
"Change how command line completion is done",
|
||||
"stringlist", "",
|
||||
{
|
||||
completer: function (value)
|
||||
completer: function completer(value)
|
||||
{
|
||||
return [
|
||||
["auto", "Automatically show completions while you are typing"],
|
||||
["sort", "Always sort the completion list"]
|
||||
];
|
||||
},
|
||||
validator: function (value)
|
||||
validator: function validator(value)
|
||||
{
|
||||
return value.split(",").every(function (item) /^(sort|auto|)$/.test(item));
|
||||
}
|
||||
@@ -562,12 +562,12 @@ function CommandLine() //{{{
|
||||
storage.styles.removeSheet("silent-mode", null, null, null, true);
|
||||
},
|
||||
|
||||
getCommand: function ()
|
||||
getCommand: function getCommand()
|
||||
{
|
||||
return commandWidget.value;
|
||||
},
|
||||
|
||||
open: function (prompt, cmd, extendedMode)
|
||||
open: function open(prompt, cmd, extendedMode)
|
||||
{
|
||||
// save the current prompts, we need it later if the command widget
|
||||
// receives focus without calling the this.open() method
|
||||
@@ -598,7 +598,7 @@ function CommandLine() //{{{
|
||||
},
|
||||
|
||||
// normally used when pressing esc, does not execute a command
|
||||
close: function ()
|
||||
close: function close()
|
||||
{
|
||||
var res = liberator.triggerCallback("cancel", currentExtendedMode);
|
||||
inputHistory.add(this.getCommand());
|
||||
@@ -606,7 +606,7 @@ function CommandLine() //{{{
|
||||
this.clear();
|
||||
},
|
||||
|
||||
clear: function ()
|
||||
clear: function clear()
|
||||
{
|
||||
multilineInputWidget.collapsed = true;
|
||||
outputContainer.collapsed = true;
|
||||
@@ -617,7 +617,7 @@ function CommandLine() //{{{
|
||||
},
|
||||
|
||||
// liberator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst
|
||||
echo: function (str, highlightGroup, flags)
|
||||
echo: function echo(str, highlightGroup, flags)
|
||||
{
|
||||
var focused = document.commandDispatcher.focusedElement;
|
||||
if (focused && focused == commandWidget.inputField || focused == multilineInputWidget.inputField)
|
||||
@@ -662,7 +662,7 @@ function CommandLine() //{{{
|
||||
|
||||
// this will prompt the user for a string
|
||||
// commandline.input("(s)ave or (o)pen the file?")
|
||||
input: function (prompt, callback, extra)
|
||||
input: function input(prompt, callback, extra)
|
||||
{
|
||||
extra = extra || {};
|
||||
|
||||
@@ -678,7 +678,7 @@ function CommandLine() //{{{
|
||||
|
||||
// reads a multi line input and returns the string once the last line matches
|
||||
// @param untilRegexp
|
||||
inputMultiline: function (untilRegexp, callbackFunc)
|
||||
inputMultiline: function inputMultiline(untilRegexp, callbackFunc)
|
||||
{
|
||||
// save the mode, because we need to restore it
|
||||
modes.push(modes.COMMAND_LINE, modes.INPUT_MULTILINE);
|
||||
@@ -694,7 +694,7 @@ function CommandLine() //{{{
|
||||
setTimeout(function () { multilineInputWidget.focus(); }, 10);
|
||||
},
|
||||
|
||||
onEvent: function (event)
|
||||
onEvent: function onEvent(event)
|
||||
{
|
||||
var command = this.getCommand();
|
||||
|
||||
@@ -944,7 +944,7 @@ function CommandLine() //{{{
|
||||
}
|
||||
},
|
||||
|
||||
onMultilineInputEvent: function (event)
|
||||
onMultilineInputEvent: function onMultilineInputEvent(event)
|
||||
{
|
||||
if (event.type == "keypress")
|
||||
{
|
||||
@@ -980,7 +980,7 @@ function CommandLine() //{{{
|
||||
|
||||
// FIXME: if 'more' is set and the MOW is not scrollable we should still
|
||||
// allow a down motion after an up rather than closing
|
||||
onMultilineOutputEvent: function (event)
|
||||
onMultilineOutputEvent: function onMultilineOutputEvent(event)
|
||||
{
|
||||
var win = multilineOutputWidget.contentWindow;
|
||||
|
||||
@@ -1177,7 +1177,7 @@ function CommandLine() //{{{
|
||||
}
|
||||
},
|
||||
|
||||
highlight: function (start, end, type)
|
||||
highlight: function highlight(start, end, type)
|
||||
{
|
||||
// FIXME: Kludge.
|
||||
try // Firefox <3.1 doesn't have repaintSelection
|
||||
@@ -1199,7 +1199,7 @@ function CommandLine() //{{{
|
||||
catch (e) {}
|
||||
},
|
||||
|
||||
updateMorePrompt: function (force, showHelp)
|
||||
updateMorePrompt: function updateMorePrompt(force, showHelp)
|
||||
{
|
||||
let win = multilineOutputWidget.contentWindow;
|
||||
function isScrollable() !win.scrollMaxY == 0;
|
||||
@@ -1213,7 +1213,7 @@ function CommandLine() //{{{
|
||||
setLine("Press ENTER or type command to continue", this.HL_QUESTION);
|
||||
},
|
||||
|
||||
updateOutputHeight: function (open)
|
||||
updateOutputHeight: function updateOutputHeight(open)
|
||||
{
|
||||
if (!open && outputContainer.collapsed)
|
||||
return;
|
||||
@@ -1233,7 +1233,7 @@ function CommandLine() //{{{
|
||||
},
|
||||
|
||||
// to allow asynchronous adding of completions
|
||||
setCompletions: function (newCompletions)
|
||||
setCompletions: function setCompletions(newCompletions)
|
||||
{
|
||||
if (liberator.mode != modes.COMMAND_LINE)
|
||||
return;
|
||||
@@ -1272,7 +1272,7 @@ function CommandLine() //{{{
|
||||
},
|
||||
|
||||
// TODO: does that function need to be public?
|
||||
resetCompletions: function ()
|
||||
resetCompletions: function resetCompletions()
|
||||
{
|
||||
autocompleteTimer.reset();
|
||||
completion.cancel();
|
||||
@@ -1403,8 +1403,8 @@ function ItemList(id) //{{{
|
||||
|
||||
return {
|
||||
|
||||
clear: function () { this.setItems(); doc.body.innerHTML = ""; },
|
||||
hide: function () { container.collapsed = true; },
|
||||
clear: function clear() { this.setItems(); doc.body.innerHTML = ""; },
|
||||
hide: function hide() { container.collapsed = true; },
|
||||
show: function show()
|
||||
{
|
||||
/* FIXME: Should only happen with autocomplete,
|
||||
@@ -1417,7 +1417,7 @@ function ItemList(id) //{{{
|
||||
}
|
||||
container.collapsed = false;
|
||||
},
|
||||
visible: function () !container.collapsed,
|
||||
visible: function visible() !container.collapsed,
|
||||
|
||||
// if @param selectedItem is given, show the list and select that item
|
||||
setItems: function setItems(newItems, selectedItem)
|
||||
@@ -1468,7 +1468,7 @@ function ItemList(id) //{{{
|
||||
return;
|
||||
},
|
||||
|
||||
onEvent: function (event) false
|
||||
onEvent: function onEvent(event) false
|
||||
};
|
||||
//}}}
|
||||
}; //}}}
|
||||
@@ -1498,7 +1498,7 @@ function StatusLine() //{{{
|
||||
"Show the status line",
|
||||
"number", 2,
|
||||
{
|
||||
setter: function (value)
|
||||
setter: function setter(value)
|
||||
{
|
||||
if (value == 0)
|
||||
document.getElementById("status-bar").collapsed = true;
|
||||
@@ -1509,7 +1509,7 @@ function StatusLine() //{{{
|
||||
|
||||
return value;
|
||||
},
|
||||
completer: function (filter)
|
||||
completer: function completer(filter)
|
||||
{
|
||||
return [
|
||||
["0", "Never display status line"],
|
||||
@@ -1517,7 +1517,7 @@ function StatusLine() //{{{
|
||||
["2", "Always display status line"]
|
||||
];
|
||||
},
|
||||
validator: function (value) value >= 0 && value <= 2
|
||||
validator: function validator(value) value >= 0 && value <= 2
|
||||
});
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
@@ -1526,7 +1526,7 @@ function StatusLine() //{{{
|
||||
|
||||
return {
|
||||
|
||||
setClass: function (type)
|
||||
setClass: function setClass(type)
|
||||
{
|
||||
const highlightGroup = {
|
||||
secure: "StatusLineSecure",
|
||||
@@ -1538,7 +1538,7 @@ function StatusLine() //{{{
|
||||
},
|
||||
|
||||
// update all fields of the statusline
|
||||
update: function ()
|
||||
update: function update()
|
||||
{
|
||||
this.updateUrl();
|
||||
this.updateInputBuffer();
|
||||
@@ -1548,7 +1548,7 @@ function StatusLine() //{{{
|
||||
},
|
||||
|
||||
// if "url" is ommited, build a usable string for the URL
|
||||
updateUrl: function (url)
|
||||
updateUrl: function updateUrl(url)
|
||||
{
|
||||
if (typeof url == "string")
|
||||
{
|
||||
@@ -1590,7 +1590,7 @@ function StatusLine() //{{{
|
||||
urlWidget.value = url;
|
||||
},
|
||||
|
||||
updateInputBuffer: function (buffer)
|
||||
updateInputBuffer: function updateInputBuffer(buffer)
|
||||
{
|
||||
if (!buffer || typeof buffer != "string")
|
||||
buffer = "";
|
||||
@@ -1598,7 +1598,7 @@ function StatusLine() //{{{
|
||||
inputBufferWidget.value = buffer;
|
||||
},
|
||||
|
||||
updateProgress: function (progress)
|
||||
updateProgress: function updateProgress(progress)
|
||||
{
|
||||
if (!progress)
|
||||
progress = "";
|
||||
@@ -1626,7 +1626,7 @@ function StatusLine() //{{{
|
||||
},
|
||||
|
||||
// you can omit either of the 2 arguments
|
||||
updateTabCount: function (currentIndex, totalTabs)
|
||||
updateTabCount: function updateTabCount(currentIndex, totalTabs)
|
||||
{
|
||||
if (!liberator.has("tabs"))
|
||||
{
|
||||
@@ -1652,7 +1652,7 @@ function StatusLine() //{{{
|
||||
},
|
||||
|
||||
// percent is given between 0 and 1
|
||||
updateBufferPosition: function (percent)
|
||||
updateBufferPosition: function updateBufferPosition(percent)
|
||||
{
|
||||
if (!percent || typeof percent != "number")
|
||||
{
|
||||
|
||||
@@ -333,7 +333,8 @@ const util = { //{{{
|
||||
i = parseInt(i);
|
||||
else if (/^[A-Z_]+$/.test(i))
|
||||
i = "";
|
||||
keys.push([i, <>{key}{noVal ? "" : <>: {value}</>}<br/>
</>]);
|
||||
keys.push([i, <>{key}{noVal ? "" : <>: {value}</> // Vim /
|
||||
}<br/>
</>]);
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
@@ -516,7 +517,7 @@ function Struct()
|
||||
ConStructor.defaultValue = function (key, val)
|
||||
{
|
||||
let i = args.indexOf(key);
|
||||
ConStructor.prototype.__defineGetter__(i, function () this[i] = val.call(this));
|
||||
ConStructor.prototype.__defineGetter__(i, function () (this[i] = val.call(this), this[i])); // Kludge for FF 3.0
|
||||
ConStructor.prototype.__defineSetter__(i, function (val) {
|
||||
let value = val;
|
||||
this.__defineGetter__(i, function () value);
|
||||
|
||||
Reference in New Issue
Block a user