1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 18:02:27 +01:00

Merge branch 'master' into vimperator-2.1

This commit is contained in:
Kris Maglione
2008-12-20 11:04:28 -05:00
13 changed files with 133 additions and 20 deletions

View File

@@ -113,3 +113,11 @@ ${DOC_FILES}: %.html: %.txt $(BASE)/Makefile.common locale/en-US/asciidoc.conf
@echo "DOC $@" @echo "DOC $@"
${ASCIIDOC} --unsafe -a linkcss -a quirks! -a doctitle="$(shell basename $@)" -o $@ $< ${ASCIIDOC} --unsafe -a linkcss -a quirks! -a doctitle="$(shell basename $@)" -o $@ $<
T2T = $(wildcard locale/*/*.t2t)
t2t: $(T2T:%.t2t=%.xhtml)
$(T2T:%.t2t=%.xhtml): locale/en-US/config.t2t
%.xhtml: %.t2t
@echo "T2T $@"
txt2tags --quiet $<

View File

@@ -1651,6 +1651,15 @@ function Marks() //{{{
return { return {
/**
* Add a named mark for the current buffer, at its current position.
* If mark matches [A-Z], it's considered a URL mark, and will jump to
* the same position at the same URL no matter what buffer it's
* selected from. If it matches [a-z'"], it's a local mark, and can
* only be recalled from a buffer with a matching URL.
*
* @param {string} mark
*/
// TODO: add support for frameset pages // TODO: add support for frameset pages
add: function (mark, silent) add: function (mark, silent)
{ {
@@ -1686,6 +1695,15 @@ function Marks() //{{{
} }
}, },
/**
* Remove all marks matching <b>filter</b>. If <b>special</b> is
* given, removes all local marks.
*
* @param {string} filter A string containing one character for each
* mark to be removed.
* @param {boolean} special Whether to delete all local marks.
*/
// FIXME: Shouldn't special be replaced with a null filter?
remove: function (filter, special) remove: function (filter, special)
{ {
if (special) if (special)
@@ -1696,20 +1714,24 @@ function Marks() //{{{
} }
else else
{ {
let pattern = new RegExp("[" + filter.replace(/\s+/g, "") + "]");
for (let [mark,] in urlMarks) for (let [mark,] in urlMarks)
{ {
if (pattern.test(mark)) if (filter.indexOf(mark) >= 0)
removeURLMark(mark); removeURLMark(mark);
} }
for (let [mark,] in localMarks) for (let [mark,] in localMarks)
{ {
if (pattern.test(mark)) if (filter.indexOf(mark) >= 0)
removeLocalMark(mark); removeLocalMark(mark);
} }
} }
}, },
/**
* Jumps to the named mark. See {@link #add}
*
* @param {string} mark The mark to jump to.
*/
jumpTo: function (mark) jumpTo: function (mark)
{ {
let ok = false; let ok = false;
@@ -1765,6 +1787,11 @@ function Marks() //{{{
liberator.echoerr("E20: Mark not set"); // FIXME: move up? liberator.echoerr("E20: Mark not set"); // FIXME: move up?
}, },
/**
* List all marks matching <b>filter</b>.
*
* @param {string} filter
*/
list: function (filter) list: function (filter)
{ {
let marks = getSortedMarks(); let marks = getSortedMarks();

View File

@@ -28,6 +28,12 @@ the terms of any one of the MPL, the GPL or the LGPL.
/** @scope modules */ /** @scope modules */
/**
* A class representing EX commands. Instances are created by
* the {@link Commands} class.
*
* @private
*/
// Do NOT create instances of this class yourself, use the helper method // Do NOT create instances of this class yourself, use the helper method
// commands.add() instead // commands.add() instead
function Command(specs, description, action, extraInfo) //{{{ function Command(specs, description, action, extraInfo) //{{{
@@ -73,30 +79,79 @@ function Command(specs, description, action, extraInfo) //{{{
}; };
let expandedSpecs = parseSpecs(specs); let expandedSpecs = parseSpecs(specs);
/** @property {string[]} All of this command's name spacs. e.g., "com[mand]" */
this.specs = specs; this.specs = specs;
/** @property {string[]} All of this command's short names, e.g., "com" */
this.shortNames = expandedSpecs.shortNames; this.shortNames = expandedSpecs.shortNames;
/** @property {string[]} All of this command's long names, e.g., "command" */
this.longNames = expandedSpecs.longNames; this.longNames = expandedSpecs.longNames;
// return the primary command name (the long name of the first spec listed) /** @property {string} The command's cannonical name. */
this.name = this.longNames[0]; this.name = this.longNames[0];
/** @property {string[]} All of this command's long and short names. */
this.names = expandedSpecs.names; // return all command name aliases this.names = expandedSpecs.names; // return all command name aliases
/** @property {string} This command's description, as shown in :exinfo */
this.description = description || ""; this.description = description || "";
/** @property {function (Args)} The function called to execute this command. */
this.action = action; this.action = action;
/** @property {string} This command's argument count spec. @see Commands#parseArguments */
this.argCount = extraInfo.argCount || 0; this.argCount = extraInfo.argCount || 0;
/** @property {function (CompletionContext, Args)} This command's completer. @see CompletionContext */
this.completer = extraInfo.completer || null; this.completer = extraInfo.completer || null;
/** @property {boolean} Whether this command accepts a here document. */
this.hereDoc = extraInfo.hereDoc || false; this.hereDoc = extraInfo.hereDoc || false;
/** @property {Array} The options this command takes. @see Commands@parseArguments */
this.options = extraInfo.options || []; this.options = extraInfo.options || [];
/** @property {boolean} Whether this command may be called with a bang, e.g., :com! */
this.bang = extraInfo.bang || false; this.bang = extraInfo.bang || false;
/** @property {boolean} Whether this command may be called with a count, e.g., :12bdel */
this.count = extraInfo.count || false; this.count = extraInfo.count || false;
/**
* @property {boolean} At what index this command's literal
* arguments begin. For instance, with a value of 2, all arguments
* starting with the third are parsed as a single string, with all
* quoting characters passed literally. This is especially useful for
* commands which take key mappings or ex command lines as
* arguments.
*/
this.literal = extraInfo.literal == null ? null : extraInfo.literal; this.literal = extraInfo.literal == null ? null : extraInfo.literal;
/**
* @property {function} Should return an array of <b>Object</b>s
* suitable to be passed to {@link Commands#commandToString}, one
* for each past invocation which should be restored on subsequent
* @liberator startups.
*/
this.serial = extraInfo.serial; this.serial = extraInfo.serial;
/**
* @property {boolean} Specifies whether this is a user command.
* User commands may be created by plugins, or directly by users,
* and, unlike basic commands, may be overwritten. Users and
* plugin authors should create only user commands.
*/
this.isUserCommand = extraInfo.isUserCommand || false; this.isUserCommand = extraInfo.isUserCommand || false;
/**
* @property {string} For commands defined via :command, contains
* the EX command line to be executed upon invocation.
*/
this.replacementText = extraInfo.replacementText || null; this.replacementText = extraInfo.replacementText || null;
}; };
Command.prototype = { Command.prototype = {
/**
* Execute this command.
*
* @param {Args} args The parsed args to be passed to
* {@link #action}.
* @param {boolean} bang @deprecated Whether this command was
* executed with a trailing !.
* @param {number} count @deprecated Whether this command was
* executed a leading count.
* @param modifiers Any modifiers to be passed to
* {@link action}
*/
execute: function (args, bang, count, modifiers) execute: function (args, bang, count, modifiers)
{ {
// XXX // XXX
@@ -130,6 +185,11 @@ Command.prototype = {
exec(args); exec(args);
}, },
/**
* Returns whether this command may be invoked via <b>name</b>.
*
* @param {string} name
*/
hasName: function (name) hasName: function (name)
{ {
for (let [,spec] in Iterator(this.specs)) for (let [,spec] in Iterator(this.specs))
@@ -145,6 +205,18 @@ Command.prototype = {
return false; return false;
}, },
/**
* A helper function to parse an argument string.
*
* @param {string} args The argument string to parse.
* @param {CompletionContext} complete A completion context.
* Non-null when the arguments are being parsed for completion
* purposes.
* @param {Object} extra Extra keys to be spliced into the
* returned Args object.
* @returns Args
* @see Commands#parseArgs
*/
parseArgs: function (args, complete, extra) commands.parseArgs(args, this.options, this.argCount, false, this.literal, complete, extra) parseArgs: function (args, complete, extra) commands.parseArgs(args, this.options, this.argCount, false, this.literal, complete, extra)
}; //}}} }; //}}}

View File

@@ -499,10 +499,12 @@ function Hints() //{{{
return function (linkText) return function (linkText)
{ {
liberator.dump(hintStrings);
if (hintStrings.length == 1 && hintStrings[0].length == 0) if (hintStrings.length == 1 && hintStrings[0].length == 0)
return true; return true;
let words = tokenize(linkText, wordSplitRegex); let words = tokenize(wordSplitRegex, linkText);
if (hintStrings.length == 1) if (hintStrings.length == 1)
return charsAtBeginningOfWords(hintStrings[0], words, allowWordOverleaping); return charsAtBeginningOfWords(hintStrings[0], words, allowWordOverleaping);
else else
@@ -510,8 +512,7 @@ function Hints() //{{{
}; };
} //}}} } //}}}
let hintMatching = options["hintmatching"]; switch (options["hintmatching"])
switch (hintMatching)
{ {
case "contains" : return containsMatcher(hintString); case "contains" : return containsMatcher(hintString);
case "wordstartswith": return wordStartsWithMatcher(hintString, /*allowWordOverleaping=*/ true); case "wordstartswith": return wordStartsWithMatcher(hintString, /*allowWordOverleaping=*/ true);

View File

@@ -868,6 +868,8 @@ lookup:
{ {
ioManager.sourcing.line = i + 1; ioManager.sourcing.line = i + 1;
// skip line comments and blank lines // skip line comments and blank lines
line = line.replace(/\r$/, "");
if (/^\s*(".*)?$/.test(line)) if (/^\s*(".*)?$/.test(line))
continue; continue;
@@ -899,7 +901,7 @@ lookup:
if (matches) if (matches)
{ {
args = matches[1]; args = matches[1];
heredocEnd = new RegExp("^" + matches[2] + "$", "m"); heredocEnd = RegExp("^" + matches[2] + "$", "m");
if (matches[1]) if (matches[1])
heredoc = matches[1] + "\n"; heredoc = matches[1] + "\n";
} }

View File

@@ -267,7 +267,6 @@ function CommandLine() //{{{
substring = substring.substr(value.length); substring = substring.substr(value.length);
this.removeSubstring = substring; this.removeSubstring = substring;
// highlight="Preview" won't work in the editor.
let node = util.xmlToDom(<span highlight="Preview">{substring}</span>, let node = util.xmlToDom(<span highlight="Preview">{substring}</span>,
document); document);
let start = this.caret; let start = this.caret;
@@ -1085,8 +1084,6 @@ function CommandLine() //{{{
} }
else if (event.type == "input") else if (event.type == "input")
{ {
if (completions)
completions.previewClear();
this.resetCompletions(); this.resetCompletions();
liberator.triggerCallback("change", currentExtendedMode, command); liberator.triggerCallback("change", currentExtendedMode, command);
} }
@@ -1445,7 +1442,10 @@ function CommandLine() //{{{
{ {
autocompleteTimer.reset(); autocompleteTimer.reset();
if (completions) if (completions)
completions.reset(); {
completions.wildIndex = -1;
completions.previewClear();
}
if (history) if (history)
history.reset(); history.reset();
} }

View File

@@ -25,6 +25,7 @@ BUGS:
- BookmarkAdd is fired once for each bookmark periodically i.e. not in response to adding a bookmark - BookmarkAdd is fired once for each bookmark periodically i.e. not in response to adding a bookmark
FEATURES: FEATURES:
9 finish :help TODOs
9 fix local options 9 fix local options
9 adaptive timeout for auto-completions, :set completions can be updated more often than 9 adaptive timeout for auto-completions, :set completions can be updated more often than
:open foo :open foo

File diff suppressed because one or more lines are too long

View File

@@ -26,8 +26,8 @@ ________________________________________________________________________________
|:echom| |:echomsg| |:echom| |:echomsg|
||:echom[sg] {expr}|| + ||:echom[sg] {expr}|| +
________________________________________________________________________________ ________________________________________________________________________________
Echo the expression as an infomational message. Just like [c]:ec[ho][c], but Echo the expression as an informational message. Just like [c]:ec[ho][c], but
also saves the message in the the message history. also saves the message in the message history.
________________________________________________________________________________ ________________________________________________________________________________

View File

@@ -144,7 +144,7 @@ ________________________________________________________________________________
|:map-<silent>| + |:map-<silent>| +
________________________________________________________________________________ ________________________________________________________________________________
When the first argument to one of the mapping commands is <silent>, {rhs} When the first argument to one of the mapping commands is <silent>, {rhs}
is not echoed to the commandline, nor, for that matter, is anything else is not echoed to the command-line, nor, for that matter, is anything else
until the command has completed. until the command has completed.
________________________________________________________________________________ ________________________________________________________________________________
@@ -324,7 +324,7 @@ Custom completion
Custom completion can be provided by specifying the "custom,{func}" argument to Custom completion can be provided by specifying the "custom,{func}" argument to
-complete. The {func} is called with two arguments, a completion context, and -complete. The {func} is called with two arguments, a completion context, and
an an object describing the command's arguments. It should set the context's an object describing the command's arguments. It should set the context's
\'completions' property, or return an object, with \'start' and \'items' \'completions' property, or return an object, with \'start' and \'items'
properties, describing the completions and where the replacement is to start. properties, describing the completions and where the replacement is to start.

View File

@@ -14,6 +14,8 @@ ________________________________________________________________________________
||:ha[rdcopy][!] >{filename}|| + ||:ha[rdcopy][!] >{filename}|| +
________________________________________________________________________________ ________________________________________________________________________________
As above, but write the output to {filename}. As above, but write the output to {filename}.
Note: Not available on Windows.
________________________________________________________________________________ ________________________________________________________________________________
section:Firefox{nbsp}printing{nbsp}dialogs[firefox-print-dialogs] section:Firefox{nbsp}printing{nbsp}dialogs[firefox-print-dialogs]

View File

@@ -62,8 +62,8 @@ and you can find out about the [m]gt[m] and [m]gT[m] mapping with
:help gt<CR> :help gt<CR>
:help gT<CR> :help gT<CR>
Finally, in addition to the help system itself, [c]:exusage[c] and Finally, in addition to the help system itself, [c]:exusage[c], [c]:viusage[c]
[c]:viusage[c] are useful quick-reference commands. and [c]:optionusage[c] are useful quick-reference commands.
section:Mouseless[living-mouseless] section:Mouseless[living-mouseless]