mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 09:17:59 +01:00
Merge default.
--HG-- branch : mode-refactoring
This commit is contained in:
@@ -58,7 +58,8 @@ const Bookmarks = Module("bookmarks", {
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
PlacesUtils.setPostDataForBookmark(id, post);
|
||||
if (post !== undefined)
|
||||
PlacesUtils.setPostDataForBookmark(id, post);
|
||||
if (keyword)
|
||||
services.get("bookmarks").setKeywordForBookmark(id, keyword);
|
||||
}
|
||||
@@ -359,7 +360,7 @@ const Bookmarks = Module("bookmarks", {
|
||||
force: args.bang,
|
||||
starOnly: false,
|
||||
keyword: args["-keyword"] || null,
|
||||
post: args["-post"] || null,
|
||||
post: args["-post"],
|
||||
tags: args["-tags"] || [],
|
||||
title: args["-title"] || (args.length === 0 ? buffer.title : null),
|
||||
url: args.length === 0 ? buffer.URL : args[0]
|
||||
|
||||
@@ -38,6 +38,9 @@ const Hints = Module("hints", {
|
||||
self._showHints();
|
||||
}
|
||||
});
|
||||
let appContent = document.getElementById("appcontent");
|
||||
if (appContent)
|
||||
events.addSessionListener(appContent, "scroll", this._resizeTimer.closure.tell, false);
|
||||
|
||||
const Mode = Hints.Mode;
|
||||
Mode.defaultValue("tags", function () function () options["hinttags"]);
|
||||
@@ -91,8 +94,15 @@ const Hints = Module("hints", {
|
||||
this._activeTimeout = null;
|
||||
},
|
||||
__reset: function () {
|
||||
if (!this._usedTabKey)
|
||||
if (!this._usedTabKey) {
|
||||
this._hintNumber = 0;
|
||||
}
|
||||
if (this.__continue && this._validHints.length <= 1) {
|
||||
this._hintString = "";
|
||||
commandline.command = this._hintString;
|
||||
this._showHints();
|
||||
}
|
||||
this._updateStatusline();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -334,11 +344,11 @@ const Hints = Module("hints", {
|
||||
* @param {boolean} active Whether it is the currently active hint or not.
|
||||
*/
|
||||
_setClass: function (elem, active) {
|
||||
let prefix = (elem.getAttributeNS(NS.uri, "class") || "") + " ";
|
||||
let prefix = (elem.getAttributeNS(NS, "class") || "") + " ";
|
||||
if (active)
|
||||
elem.setAttributeNS(NS.uri, "highlight", prefix + "HintActive");
|
||||
elem.setAttributeNS(NS, "highlight", prefix + "HintActive");
|
||||
else
|
||||
elem.setAttributeNS(NS.uri, "highlight", prefix + "HintElem");
|
||||
elem.setAttributeNS(NS, "highlight", prefix + "HintElem");
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -363,7 +373,7 @@ const Hints = Module("hints", {
|
||||
hint.imgSpan.style.display = (valid ? "" : "none");
|
||||
|
||||
if (!valid) {
|
||||
hint.elem.removeAttributeNS(NS.uri, "highlight");
|
||||
hint.elem.removeAttributeNS(NS, "highlight");
|
||||
continue inner;
|
||||
}
|
||||
|
||||
@@ -399,7 +409,7 @@ const Hints = Module("hints", {
|
||||
// FIXME: Broken for imgspans.
|
||||
for (let [, { doc: doc }] in Iterator(this._docs)) {
|
||||
for (let elem in util.evaluateXPath("//*[@dactyl:highlight and @number]", doc)) {
|
||||
let group = elem.getAttributeNS(NS.uri, "highlight");
|
||||
let group = elem.getAttributeNS(NS, "highlight");
|
||||
css.push(highlight.selector(group) + "[number=" + elem.getAttribute("number").quote() + "] { " + elem.style.cssText + " }");
|
||||
}
|
||||
}
|
||||
@@ -418,20 +428,12 @@ const Hints = Module("hints", {
|
||||
* hint disappears.
|
||||
*/
|
||||
_removeHints: function (timeout, slight) {
|
||||
let firstElem = this._validHints[0] || null;
|
||||
|
||||
for (let [,{ doc: doc, start: start, end: end }] in Iterator(this._docs)) {
|
||||
util.dump(String(doc), start, end);
|
||||
for (let elem in util.evaluateXPath("//*[@dactyl:highlight='hints']", doc))
|
||||
elem.parentNode.removeChild(elem);
|
||||
for (let i in util.range(start, end + 1)) {
|
||||
let hint = this._pageHints[i];
|
||||
if (!timeout || hint.elem != firstElem)
|
||||
hint.elem.removeAttributeNS(NS.uri, "highlight");
|
||||
}
|
||||
|
||||
// animate the disappearance of the first hint
|
||||
if (timeout && firstElem)
|
||||
this.timeout(function () { firstElem.removeAttributeNS(NS.uri, "highlight"); }, timeout);
|
||||
for (let i in util.range(start, end + 1))
|
||||
this._pageHints[i].elem.removeAttributeNS(NS, "highlight");
|
||||
}
|
||||
styles.removeSheet(true, "hint-positions");
|
||||
|
||||
@@ -479,17 +481,21 @@ const Hints = Module("hints", {
|
||||
let activeIndex = (this._hintNumber ? this._hintNumber - 1 : 0);
|
||||
let elem = this._validHints[activeIndex];
|
||||
let top = this._top;
|
||||
if (this._continue) {
|
||||
|
||||
if (this._continue)
|
||||
this.__reset();
|
||||
if (this._validHints.length <= 1)
|
||||
this._showHints();
|
||||
}
|
||||
else {
|
||||
else
|
||||
this._removeHints(timeout);
|
||||
if (timeout == 0)
|
||||
// force a possible mode change, based on whether an input field has focus
|
||||
events.onFocusChange();
|
||||
}
|
||||
|
||||
let n = 5;
|
||||
(function next() {
|
||||
this._setClass(elem, n % 2);
|
||||
util.dump(n, String(this._top));
|
||||
if (n--)
|
||||
this.timeout(next, 50);
|
||||
else if (!this._validHints.some(function (h) h.elem == elem))
|
||||
elem.removeAttributeNS(NS, "highlight");
|
||||
}).call(this);
|
||||
|
||||
this.timeout(function () {
|
||||
if ((modes.extended & modes.HINTS) && !this._continue)
|
||||
@@ -512,7 +518,9 @@ const Hints = Module("hints", {
|
||||
if (this._hintNumber > 0 && this._hintNumber * this.hintKeys.length <= this._validHints.length) {
|
||||
let timeout = options["hinttimeout"];
|
||||
if (timeout > 0)
|
||||
this._activeTimeout = this.timeout(function () { this._processHints(true); }, timeout);
|
||||
this._activeTimeout = this.timeout(function () {
|
||||
this._processHints(true);
|
||||
}, timeout);
|
||||
}
|
||||
else // we have a unique hint
|
||||
this._processHints(true);
|
||||
@@ -906,6 +914,7 @@ const Hints = Module("hints", {
|
||||
dactyl.assert(this._hintNumber != 0);
|
||||
|
||||
this._checkUnique();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -537,7 +537,7 @@ const JavaScript = Module("javascript", {
|
||||
args.push(key + string);
|
||||
|
||||
let compl = function (context, obj) {
|
||||
let res = completer.call(self, context, funcName, obj, args);
|
||||
let res = completer.call(self, context, funcName, obj.obj, args);
|
||||
if (res)
|
||||
context.completions = res;
|
||||
};
|
||||
|
||||
@@ -12,29 +12,29 @@
|
||||
|
||||
<toc/>
|
||||
|
||||
<include href="intro" tag="intro.html"/>
|
||||
<include href="starting" tag="starting.html"/>
|
||||
<include href="browsing" tag="browsing.html"/>
|
||||
<include href="buffer" tag="buffer.html"/>
|
||||
<include href="cmdline" tag="cmdline.html"/>
|
||||
<include href="insert" tag="insert.html"/>
|
||||
<include href="options" tag="options.html"/>
|
||||
<include href="pattern" tag="pattern.html"/>
|
||||
<include href="tabs" tag="tabs.html"/>
|
||||
<include href="hints" tag="hints.html"/>
|
||||
<include href="map" tag="map.html"/>
|
||||
<include href="eval" tag="eval.html"/>
|
||||
<include href="marks" tag="marks.html"/>
|
||||
<include href="repeat" tag="repeat.html"/>
|
||||
<include href="autocommands" tag="autocommands.html"/>
|
||||
<include href="print" tag="print.html"/>
|
||||
<include href="gui" tag="gui.html"/>
|
||||
<include href="styling" tag="styling.html"/>
|
||||
<include href="message" tag="message.html"/>
|
||||
<include href="developer" tag="developer.html"/>
|
||||
<include href="various" tag="various.html"/>
|
||||
<include href="plugins" tag="plugins.html"/>
|
||||
<include href="index" tag="index.html"/>
|
||||
<include href="intro" tag="intro.xml"/>
|
||||
<include href="starting" tag="starting.xml"/>
|
||||
<include href="browsing" tag="browsing.xml"/>
|
||||
<include href="buffer" tag="buffer.xml"/>
|
||||
<include href="cmdline" tag="cmdline.xml"/>
|
||||
<include href="insert" tag="insert.xml"/>
|
||||
<include href="options" tag="options.xml"/>
|
||||
<include href="pattern" tag="pattern.xml"/>
|
||||
<include href="tabs" tag="tabs.xml"/>
|
||||
<include href="hints" tag="hints.xml"/>
|
||||
<include href="map" tag="map.xml"/>
|
||||
<include href="eval" tag="eval.xml"/>
|
||||
<include href="marks" tag="marks.xml"/>
|
||||
<include href="repeat" tag="repeat.xml"/>
|
||||
<include href="autocommands" tag="autocommands.xml"/>
|
||||
<include href="print" tag="print.xml"/>
|
||||
<include href="gui" tag="gui.xml"/>
|
||||
<include href="styling" tag="styling.xml"/>
|
||||
<include href="message" tag="message.xml"/>
|
||||
<include href="developer" tag="developer.xml"/>
|
||||
<include href="various" tag="various.xml"/>
|
||||
<include href="plugins" tag="plugins.xml"/>
|
||||
<include href="index" tag="index.xml"/>
|
||||
|
||||
</document>
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
||||
<h2 tag="cmdline-lines">Ex command lines</h2>
|
||||
|
||||
<item>
|
||||
@@ -212,7 +213,73 @@
|
||||
</ul>
|
||||
</p>
|
||||
</description>
|
||||
</item>
|
||||
</item>
|
||||
|
||||
<h3 tag="cmdline-arguments">Ex command-line arguments</h3>
|
||||
|
||||
<p>
|
||||
Most Ex commands accept a number of options and arguments. Arguments and
|
||||
options are generally separated by spaces, and treat a number of
|
||||
characters, including <em>\</em>, <em>'</em>, <em>"</em>, and <em>|</em>,
|
||||
specially. Moreover, certain arguments have their own special characters.
|
||||
For instance, when using <ex>:set</ex> to change a <t>stringlist</t>
|
||||
option, the comma character is used to separate elements of said list. Or
|
||||
when calling <ex>:autocmd</ex>, the pattern given may be negated by
|
||||
prefixing it with a <em>!</em>. In order to use these characters in
|
||||
command arguments, stripped of their special meaning, they must be quoted.
|
||||
</p>
|
||||
|
||||
<p tag="cmdline-quoting quoting">
|
||||
&dactyl.appName; offers four distinct quoting styles, each with its own
|
||||
distinct advantages and disadvantages. The first, and most basic, is the
|
||||
automatic quoting applied to the commands listed in <ex>:bar</ex>. When
|
||||
any of these commands is invoked, their final argument is always
|
||||
interpreted literally. No characters have special meaning whatsoever, and
|
||||
no care need be taken to quote anything. Additionally, the following three
|
||||
optional quoting characters are available:
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
<dt>\</dt>
|
||||
<dd>
|
||||
This is the most basic quoting character. When it is encountered
|
||||
outside of single or double quotes, it forces the next character to be
|
||||
interpreted literally. So, for instance, <tt>\\</tt> ⇒ <tt>\</tt>,
|
||||
<tt>\'</tt> ⇒ <tt>'</tt>, <tt>\a</tt> ⇒ <tt>a</tt>, and
|
||||
<tt>\␣</tt> ⇒ <tt>␣</tt>.
|
||||
</dd>
|
||||
<dt>'</dt>
|
||||
<dd>
|
||||
Any character inside single quotes aside from the ' character itself
|
||||
is interpreted literally. To include a literal single quote, it must
|
||||
be doubled. So, <code>'foo\ ''bar\\ baz\' ⇒ foo\ 'bar\\ baz\</code>
|
||||
</dd>
|
||||
<dt>"</dt>
|
||||
<dd>
|
||||
Any character inside of double quotes except for <em>"</em> and
|
||||
<em>\</em> is interpreted literally. A literal double quote may be
|
||||
included by preceding it with a backslash. Any other occurrence of a
|
||||
backslash starts an escape sequence as in JavaScript strings. Among
|
||||
the available escape sequences are:
|
||||
<dl>
|
||||
<dt>\n</dt> <dd>A newline character.</dd>
|
||||
<dt>\t</dt> <dd>A tab character.</dd>
|
||||
<dt>\0nn</dt> <dd>Where each <em>n</em> is a digit between 0 and 7, represents an octal character code.</dd>
|
||||
<dt>\xdd</dt> <dd>Where each <em>d</em> is a digit between 0 and F, represents a hexidecimal character code.</dd>
|
||||
<dt>\uxxxx</dt> <dd>Where each <em>x</em> is a digit between 0 and F, a Unicode character at code-point <em>xxxx</em>.</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p tag="cmdline-options">
|
||||
Many Ex commands accept option arguments in addition to regular arguments.
|
||||
Option arguments begin with a hyphen (<em>-</em>), and often have a short
|
||||
form and a long form, such as <em>-name</em> and <em>-n</em>. Most options
|
||||
accept arguments, which come after the option separated by either a space
|
||||
or an equal sign. For instance, the following three forms,
|
||||
<ex>-name=<str>foo</str></ex>, <ex>-name <str>foo</str></ex>, and
|
||||
<ex>-n <str>foo</str></ex>, are all acceptable and entirely equivalent.
|
||||
</p>
|
||||
|
||||
</document>
|
||||
|
||||
|
||||
@@ -816,7 +816,7 @@ Class.prototype = {
|
||||
*/
|
||||
timeout: function (callback, timeout) {
|
||||
const self = this;
|
||||
let notify = { notify: function notify(timer) { callback.call(self) } };
|
||||
let notify = { notify: function notify(timer) { try { callback.apply(self) } catch (e) { util.reportError(e) } } };
|
||||
let timer = services.create("timer");
|
||||
timer.initWithCallback(notify, timeout || 0, timer.TYPE_ONE_SHOT);
|
||||
return timer;
|
||||
|
||||
@@ -292,8 +292,12 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR
|
||||
"Set the 'private browsing' option",
|
||||
"boolean", false,
|
||||
{
|
||||
setter: function (value) services.get("privateBrowsing").privateBrowsingEnabled = value,
|
||||
getter: function () services.get("privateBrowsing").privateBrowsingEnabled
|
||||
initialValue: true,
|
||||
getter: function () services.get("privateBrowsing").privateBrowsingEnabled,
|
||||
setter: function (value) {
|
||||
if (services.get("privateBrowsing").privateBrowsingEnabled != value)
|
||||
services.get("privateBrowsing").privateBrowsingEnabled = value
|
||||
}
|
||||
});
|
||||
|
||||
options.add(["sanitizeitems", "si"],
|
||||
|
||||
@@ -25,7 +25,6 @@ BUGS:
|
||||
(recent Mercurial regressions):
|
||||
|
||||
FEATURES:
|
||||
9 Add quoting help tag
|
||||
8 Document Caret and Visual modes.
|
||||
8 replace global variables with plugin scoped user options
|
||||
8 fix local options
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns="&xmlns.dactyl;"
|
||||
xmlns:html="&xmlns.html;">
|
||||
|
||||
<include href="tutorial" tag="tutorial.html" insertafter="intro.html" />
|
||||
<include href="tutorial" tag="tutorial.xml" insertafter="intro.xml" />
|
||||
|
||||
</overlay>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user