1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-13 14:25:51 +01:00

Merge branch 'master' into vimperator-2.1

Conflicts:
	vimperator/NEWS
This commit is contained in:
Kris Maglione
2009-01-21 03:40:04 -05:00
42 changed files with 340 additions and 177 deletions

View File

@@ -6,6 +6,9 @@ BASE = ../../../common
THIS_LOCALE = $(notdir $(shell pwd))
THIS_LANG = $(firstword $(subst -, ,$(THIS_LOCALE)))
ifneq ($(strip $(shell echo -n $(THIS_LANG) | wc -c)),2)
THIS_LANG = en
endif
ADC_SRC_FILES = $(wildcard *.txt)
ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html)

View File

@@ -68,7 +68,7 @@ function Buffer() //{{{
ZoomManager.zoom = value / 100;
if ("FullZoom" in window)
FullZoom._applySettingToPref();
liberator.echo((fullZoom ? "Full" : "Text") + " zoom: " + value + "%");
liberator.echomsg((fullZoom ? "Full" : "Text") + " zoom: " + value + "%");
}
function bumpZoomLevel(steps, fullZoom)

View File

@@ -463,7 +463,15 @@ function Commands() //{{{
// using literal etc
parseArgs: function (str, options, argCount, allowUnknownOptions, literal, complete, extra)
{
function getNextArg(str) commands.parseArg(str);
function getNextArg(str)
{
let [count, arg, quote] = commands.parseArg(str);
if (quote == "\\" && !complete)
return [,,,"Trailing \\"];
if (quote && !complete)
return [,,,"E114: Missing quote: " + quote];
return [count, arg, quote];
}
if (!options)
options = [];
@@ -555,9 +563,9 @@ function Commands() //{{{
let sep = sub[optname.length];
if (sep == "=" || /\s/.test(sep) && opt[1] != this.OPTION_NOARG)
{
[count, arg, quote] = getNextArg(sub.substr(optname.length + 1));
if (quote == "\\" && !complete)
return liberator.echoerr("Trailing \\");
[count, arg, quote, error] = getNextArg(sub.substr(optname.length + 1));
if (error)
return liberator.echoerr(error);
// if we add the argument to an option after a space, it MUST not be empty
if (sep != "=" && !quote && arg.length == 0)
@@ -615,7 +623,7 @@ function Commands() //{{{
}
}
args[opt[0][0]] = arg; // always use the first name of the option
args[opt[0][0]] = opt[1] == this.OPTION_NOARG || arg; // always use the first name of the option
i += optname.length + count;
if (i == str.length)
break outer;
@@ -646,9 +654,9 @@ function Commands() //{{{
}
// if not an option, treat this token as an argument
var [count, arg, quote] = getNextArg(sub);
if (quote == "\\" && !complete)
return liberator.echoerr("Trailing \\");
let [count, arg, quote, error] = getNextArg(sub);
if (error)
return liberator.echoerr(error);
if (complete)
{

View File

@@ -579,7 +579,7 @@ CompletionContext.prototype = {
let context = new CompletionContext(this, name, offset);
this.contextList.push(context);
if (completer)
return completer.apply(self || this, [context].concat(Array.slice(arguments, 4)));
return completer.apply(self || this, [context].concat(Array.slice(arguments, arguments.callee.length)));
return context;
},
@@ -835,7 +835,7 @@ function Completion() //{{{
// Get an element from the stack. If @n is negative,
// count from the top of the stack, otherwise, the bottom.
// If @m is provided, return the @mth value of element @o
// of the stack entey at @n.
// of the stack entry at @n.
let get = function get(n, m, o)
{
let a = stack[n >= 0 ? n : stack.length + n];
@@ -1553,6 +1553,9 @@ function Completion() //{{{
}
},
// XXX
highlightGroup: function highlightGroup(context, args) commands.get("highlight").completer(context, args),
history: function _history(context, maxItems)
{
context.format = history.format;
@@ -1800,15 +1803,19 @@ function Completion() //{{{
context.advance(skip[0].length);
// Will, and should, throw an error if !(c in opts)
Array.forEach(complete || options["complete"],
function (c) context.fork(c, 0, completion, completion.urlCompleters[c].completer));
Array.forEach(complete || options["complete"], function (c) {
let completer = completion.urlCompleters[c];
context.fork.apply(context, [c, 0, completion, completer.completer].concat(completer.args));
});
},
urlCompleters: {},
addUrlCompleter: function addUrlCompleter(opt)
{
this.urlCompleters[opt] = UrlCompleter.apply(null, Array.slice(arguments));
let completer = UrlCompleter.apply(null, Array.slice(arguments));
completer.args = Array.slice(arguments, completer.length);
this.urlCompleters[opt] = completer;
},
urls: function (context, tags)

View File

@@ -46,6 +46,45 @@ function Editor() //{{{
// XXX: this strikes me as a rather odd ds; everyone's a critic --djk
var abbreviations = {}; // abbreviations["lhr"][0]["{i,c,!}","rhs"]
// (summarized from Vim's ":help abbreviations")
//
// There are three types of abbreviations:
//
// full-id: Consists entirely of keyword characters.
// ("foo", "g3", "-1")
//
// end-id: Ends in a keyword character, but all other
// are not keyword characters.
// ("#i", "..f", "$/7")
//
// non-id: Ends in a non-keyword character, but the
// others can be of any type other than space
// and tab.
// ("def#", "4/7$")
//
// Example strings that cannot be abbreviations:
// "a.b", "#def", "a b", "_$r"
//
// For now, a keyword character is anything except for \s, ", or '
// (i.e., whitespace and quotes). In Vim, a keyword character is
// specified by the 'iskeyword' setting and is a much less inclusive
// list.
//
// TODO: Make keyword definition closer to Vim's default keyword
// definition (which differs across platforms).
//
let nonkw = "\\s\"'";
let keyword = "[^" + nonkw + "]";
let nonkeyword = "[" + nonkw + "]";
let full_id = keyword + "+";
let end_id = nonkeyword + "+" + keyword;
let non_id = "\\S*" + nonkeyword;
// Used in addAbbrevation and expandAbbreviation
var abbrevmatch = full_id + "|" + end_id + "|" + non_id;
function getEditor()
{
return window.document.commandDispatcher.focusedElement;
@@ -164,7 +203,13 @@ function Editor() //{{{
"Abbreviate a key sequence" + modeDescription,
function (args)
{
let [lhs, rhs] = args;
let matches = args.string.match(RegExp("^\\s*($|" + abbrevmatch + ")(?:\\s*$|\\s+(.*))"));
if (! matches)
{
liberator.echoerr("E474: Invalid argument");
return false;
}
let [,lhs,rhs] = matches;
if (rhs)
editor.addAbbreviation(mode, lhs, rhs);
else
@@ -172,7 +217,7 @@ function Editor() //{{{
},
{
completer: function (context, args) completion.abbreviation(context, args, mode),
literal: 1,
literal: 0,
serial: function () [
{
command: this.name,
@@ -1010,7 +1055,7 @@ function Editor() //{{{
let text = textbox.value;
let currStart = textbox.selectionStart;
let currEnd = textbox.selectionEnd;
let foundWord = text.substring(0, currStart).replace(/^(.|\n)*?(\S+)$/m, "$2"); // get last word \b word boundary
let foundWord = text.substring(0, currStart).replace(RegExp("^(.|\\n)*?\\s*(" + abbrevmatch + ")$", "m"), "$2"); // get last word \b word boundary
if (!foundWord)
return true;

View File

@@ -887,7 +887,7 @@ function Events() //{{{
* to be taken literally, prepend it with a "\\".
* @param {boolean} noremap Allow recursive mappings.
* @param {boolean} silent Whether the command should be echoed to the
* command-line.
* command line.
* @returns {boolean}
*/
feedkeys: function (keys, noremap, silent)

View File

@@ -74,9 +74,9 @@ function Hints() //{{{
b: Mode("Follow hint in a background tab", function (elem) buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB)),
w: Mode("Follow hint in a new window", function (elem) buffer.followLink(elem, liberator.NEW_WINDOW), extended),
F: Mode("Open multiple hints in tabs", hintAction_F),
O: Mode(":open URL based on hint location", function (elem, loc) commandline.open(":", "open " + loc, modes.EX)),
T: Mode(":tabopen URL based on hint location", function (elem, loc) commandline.open(":", "tabopen " + loc, modes.EX)),
W: Mode(":winopen URL based on hint location", function (elem, loc) commandline.open(":", "winopen " + loc, modes.EX)),
O: Mode("Generate an ':open URL' using hint", function (elem, loc) commandline.open(":", "open " + loc, modes.EX)),
T: Mode("Generate a ':tabopen URL' using hint",function (elem, loc) commandline.open(":", "tabopen " + loc, modes.EX)),
W: Mode("Generate a ':winopen URL' using hint",function (elem, loc) commandline.open(":", "winopen " + loc, modes.EX)),
v: Mode("View hint source", function (elem, loc) buffer.viewSource(loc, false), extended),
V: Mode("View hint source in external editor", function (elem, loc) buffer.viewSource(loc, true), extended),
y: Mode("Yank hint location", function (elem, loc) util.copyToClipboard(loc, true)),

View File

@@ -113,8 +113,13 @@ function IO() //{{{
try
{
path.appendRelativePath(self.expandPath(tail, true)); // FIXME: should only expand env vars and normalise path separators
if (path.exists() && path.normalize)
path.normalize();
// TODO: This code breaks the external editor at least in ubuntu
// because /usr/bin/gvim becomes /usr/bin/vim.gnome normalized and for
// some strange reason it will start without a gui then (which is not
// optimal if you don't start firefox from a terminal ;)
// Why do we need this code?
// if (path.exists() && path.normalize)
// path.normalize();
}
catch (e)
{

View File

@@ -656,7 +656,7 @@ const liberator = (function () //{{{
beep: function ()
{
// FIXME: popups clear the command-line
// FIXME: popups clear the command line
if (options["visualbell"])
{
// flash the visual bell
@@ -745,7 +745,7 @@ const liberator = (function () //{{{
// But it's _supposed_ to show the MOW on startup when there are
// messages, surely? As far as I'm concerned it essentially works
// exactly as it should with the DISALLOW_MULTILINE flag removed.
// Sending N messages to the command-line in a row and having them
// Sending N messages to the command line in a row and having them
// overwrite each other is completely broken. I also think many of
// those messages like "Added quick mark" are plain silly but if
// you don't like them you can set verbose=0, or use :silent when

View File

@@ -700,7 +700,11 @@ function Options() //{{{
" ";
liberator.echo(reference[1] + "\t\t" + prefix + value);
}
});
},
{
literal: 0
}
);
commands.add(["setl[ocal]"],
"Set local option",

View File

@@ -223,9 +223,14 @@ function Tabs() //{{{
"Go to the last tab",
function (count) { tabs.select("$"); });
mappings.add([modes.NORMAL], ["gt", "<C-n>", "<C-Tab>", "<C-PageDown>"],
mappings.add([modes.NORMAL], ["gt"],
"Go to the next tab",
function (count) { tabs.select(count > 0 ? count - 1: "+1", count > 0 ? false : true); },
function (count) { tabs.select(count > 0 ? count - 1 : "+1", count > 0 ? false : true); },
{ flags: Mappings.flags.COUNT });
mappings.add([modes.NORMAL], ["<C-n>", "<C-Tab>", "<C-PageDown>"],
"Go to the next tab",
function (count) { tabs.select("+" + (count < 1 ? 1 : count), true); },
{ flags: Mappings.flags.COUNT });
mappings.add([modes.NORMAL], ["gT", "<C-p>", "<C-S-Tab>", "<C-PageUp>"],
@@ -629,7 +634,7 @@ function Tabs() //{{{
"Undo closing of all closed tabs",
function (args)
{
for (let i in Itarator(tabs.closedTabs))
for (let i in Iterator(tabs.closedTabs))
window.undoCloseTab(0);
},

View File

@@ -605,7 +605,7 @@ function CommandLine() //{{{
}
/**
* Determines whether the command-line should be visible.
* Determines whether the command line should be visible.
*
* @return {boolean}
*/
@@ -878,8 +878,15 @@ function CommandLine() //{{{
["<C-c>"], "Focus content",
function () { events.onEscape(); });
// Any "non-keyword" character triggers abbreviation expansion
// TODO: Add "<CR>" and "<Tab>" to this list
// At the moment, adding "<Tab>" breaks tab completion. Adding
// "<CR>" has no effect.
// TODO: Make non-keyword recognition smarter so that there need not
// be two lists of the same characters (one here and a regexp in
// mappings.js)
mappings.add(myModes,
["<Space>"], "Expand command line abbreviation",
["<Space>", '"', "'"], "Expand command line abbreviation",
function ()
{
commandline.resetCompletions();
@@ -1037,7 +1044,7 @@ function CommandLine() //{{{
get message() messageBox.value,
/**
* Open the command-line. The main mode is set to
* Open the command line. The main mode is set to
* COMMAND_LINE, the extended mode to <b>extendedMode</b>.
* Further, callbacks defined for <b>extendedMode</b> are
* triggered as appropriate (see {@link Liberator#registerCallback}).
@@ -1072,8 +1079,8 @@ function CommandLine() //{{{
},
/**
* Closes the command-line. This is ordinarily triggered automatically
* by a mode change. Will not hide the command-line immediately if
* Closes the command line. This is ordinarily triggered automatically
* by a mode change. Will not hide the command line immediately if
* called directly after a successful command, otherwise it will.
*/
close: function close()
@@ -1110,7 +1117,7 @@ function CommandLine() //{{{
},
/**
* Hides the command-line, and shows any status messages that
* Hides the command line, and shows any status messages that
* are under it.
*/
hide: function hide()
@@ -1119,7 +1126,7 @@ function CommandLine() //{{{
},
/**
* Output the given string onto the command-line. With no flags, the
* Output the given string onto the command line. With no flags, the
* message will be shown in the status line if it's short enough to
* fit, and contains no new lines, and isn't XML. Otherwise, it will be
* shown in the MOW.

View File

@@ -177,7 +177,7 @@ const util = { //{{{
/**
* Copies a string to the system clipboard. If <b>verbose</b> is specified
* the copied string is also echoed to the command-line.
* the copied string is also echoed to the command line.
*
* @param {string} str
* @param {boolean} verbose