mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 11:08:09 +01:00
Add {, }, [{arg}, ]{arg}. Closes issue #592.
This commit is contained in:
@@ -797,6 +797,37 @@ var Buffer = Module("buffer", {
|
|||||||
return win;
|
return win;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the next visible element for the node path in 'jumptags'
|
||||||
|
* for *arg*.
|
||||||
|
*
|
||||||
|
* @param {string} arg The element in 'jumptags' to use for the search.
|
||||||
|
* @param {number} count The number of elements to jump.
|
||||||
|
* @optional
|
||||||
|
* @param {boolean} reverse If true, search backwards. @optional
|
||||||
|
*/
|
||||||
|
findJump: function findJump(arg, count, reverse) {
|
||||||
|
const FUDGE = 10;
|
||||||
|
|
||||||
|
let path = options["jumptags"][arg];
|
||||||
|
dactyl.assert(path, _("error.invalidArgument", arg));
|
||||||
|
|
||||||
|
let distance = reverse ? function (rect) -rect.top : function (rect) rect.top;
|
||||||
|
let elems = [[e, distance(e.getBoundingClientRect())] for (e in path.matcher(this.focusedFrame.document))]
|
||||||
|
.filter(function (e) e[1] > FUDGE)
|
||||||
|
.sort(function (a, b) a[1] - b[1])
|
||||||
|
|
||||||
|
let idx = Math.min((count || 1) - 1, elems.length);
|
||||||
|
dactyl.assert(idx in elems);
|
||||||
|
|
||||||
|
let elem = elems[idx][0];
|
||||||
|
elem.scrollIntoView(true);
|
||||||
|
|
||||||
|
let sel = elem.ownerDocument.defaultView.getSelection();
|
||||||
|
sel.removeAllRanges();
|
||||||
|
sel.addRange(RangeFind.endpoint(RangeFind.nodeRange(elem), true));
|
||||||
|
},
|
||||||
|
|
||||||
// TODO: allow callback for filtering out unwanted frames? User defined?
|
// TODO: allow callback for filtering out unwanted frames? User defined?
|
||||||
/**
|
/**
|
||||||
* Shifts the focus to another frame within the buffer. Each buffer
|
* Shifts the focus to another frame within the buffer. Each buffer
|
||||||
@@ -1742,6 +1773,26 @@ var Buffer = Module("buffer", {
|
|||||||
function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); },
|
function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
|
mappings.add([modes.NORMAL], ["["],
|
||||||
|
"Jump to the previous element as defined by 'jumptags'",
|
||||||
|
function (args) { buffer.findJump(args.arg, args.count, true); },
|
||||||
|
{ arg: true, count: true });
|
||||||
|
|
||||||
|
mappings.add([modes.NORMAL], ["]"],
|
||||||
|
"Jump to the next element as defined by 'jumptags'",
|
||||||
|
function (args) { buffer.findJump(args.arg, args.count, false); },
|
||||||
|
{ arg: true, count: true });
|
||||||
|
|
||||||
|
mappings.add([modes.NORMAL], ["{"],
|
||||||
|
"Jump to the previous paragraph",
|
||||||
|
function (args) { buffer.findJump("p", args.count, true); },
|
||||||
|
{ count: true });
|
||||||
|
|
||||||
|
mappings.add([modes.NORMAL], ["}"],
|
||||||
|
"Jump to the next paragraph",
|
||||||
|
function (args) { buffer.findJump("p", args.count, false); },
|
||||||
|
{ count: true });
|
||||||
|
|
||||||
mappings.add([modes.NORMAL], ["]]", "<next-page>"],
|
mappings.add([modes.NORMAL], ["]]", "<next-page>"],
|
||||||
"Follow the link labeled 'next' or '>' if it exists",
|
"Follow the link labeled 'next' or '>' if it exists",
|
||||||
function (args) {
|
function (args) {
|
||||||
@@ -1937,6 +1988,23 @@ var Buffer = Module("buffer", {
|
|||||||
validator: function (value) RegExp(value)
|
validator: function (value) RegExp(value)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
options.add(["jumptags", "jt"],
|
||||||
|
"XPath or CSS selector strings of jumpable elements for extended hint modes",
|
||||||
|
"stringmap", {
|
||||||
|
"p": "p,table,ul,ol,blockquote",
|
||||||
|
"h": "h1,h2,h3,h4,h5,h6"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
keepQuotes: true,
|
||||||
|
setter: function (vals) {
|
||||||
|
for (let [k, v] in Iterator(vals))
|
||||||
|
vals[k] = update(new String(v), { matcher: util.compileMatcher(Option.splitList(v)) });
|
||||||
|
return vals;
|
||||||
|
},
|
||||||
|
validator: function (value) util.validateMatcher.call(this, value)
|
||||||
|
&& Object.keys(value).every(function (v) v.length == 1)
|
||||||
|
});
|
||||||
|
|
||||||
options.add(["nextpattern"],
|
options.add(["nextpattern"],
|
||||||
"Patterns to use when guessing the next page in a document sequence",
|
"Patterns to use when guessing the next page in a document sequence",
|
||||||
"regexplist", UTF8("'\\bnext\\b',^>$,^(>>|»)$,^(>|»),(>|»)$,'\\bmore\\b'"),
|
"regexplist", UTF8("'\\bnext\\b',^>$,^(>>|»)$,^(>|»),(>|»)$,'\\bmore\\b'"),
|
||||||
|
|||||||
@@ -1016,6 +1016,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (obj instanceof Option) {
|
else if (obj instanceof Option) {
|
||||||
|
tag = spec = function (name) <>'{name}'</>;
|
||||||
link = function (opt, name) <o>{name}</o>;
|
link = function (opt, name) <o>{name}</o>;
|
||||||
args = { value: "", values: [] };
|
args = { value: "", values: [] };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,6 +328,39 @@
|
|||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<tags>[h [p [</tags>
|
||||||
|
<spec><oa>count</oa>[<a>arg</a></spec>
|
||||||
|
<description short="true">
|
||||||
|
<p>Jump to the previous element as defined by <o>jumptags</o>.</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<tags>]h ]p ]</tags>
|
||||||
|
<spec><oa>count</oa>]<a>arg</a></spec>
|
||||||
|
<description short="true">
|
||||||
|
<p>Jump to the next element as defined by <o>jumptags</o>.</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<tags>{</tags>
|
||||||
|
<spec><oa>count</oa>{</spec>
|
||||||
|
<description short="true">
|
||||||
|
<p>Jump to the previous paragraph. Identical to <k>[p</k>.</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<tags>}</tags>
|
||||||
|
<spec><oa>count</oa>}</spec>
|
||||||
|
<description short="true">
|
||||||
|
<p>Jump to the next paragraph. Identical to <k>]p</k>.</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
|
||||||
<h2 tag="zooming zoom">Zooming</h2>
|
<h2 tag="zooming zoom">Zooming</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -987,6 +987,16 @@
|
|||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<tags>'jt' 'jumptags'</tags>
|
||||||
|
<spec>'jumptags'</spec>
|
||||||
|
<type>&option.jumptags.type;</type>
|
||||||
|
<default>&option.jumptags.default;</default>
|
||||||
|
<description>
|
||||||
|
<p>XPath or CSS selector strings of jumpable elements for extended hint modes.</p>
|
||||||
|
</description>
|
||||||
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<tags>'lpl' 'loadplugins'</tags>
|
<tags>'lpl' 'loadplugins'</tags>
|
||||||
<spec>'loadplugins' 'lpl'</spec>
|
<spec>'loadplugins' 'lpl'</spec>
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ var Template = Module("Template", {
|
|||||||
linkifyHelp: function linkifyHelp(str, help) {
|
linkifyHelp: function linkifyHelp(str, help) {
|
||||||
let re = util.regexp(<![CDATA[
|
let re = util.regexp(<![CDATA[
|
||||||
(?P<pre> [/\s]|^)
|
(?P<pre> [/\s]|^)
|
||||||
(?P<tag> '[\w-]+' | :(?:[\w-]+!?|!) | (?:._)?<[\w-]+>\w* | [a-zA-Z]_\w+ | \[[\w-]+\] | E\d{3} )
|
(?P<tag> '[\w-]+' | :(?:[\w-]+!?|!) | (?:._)?<[\w-]+>\w* | \b[a-zA-Z]_(?:\w+|.) | \[[\w-]+\] | E\d{3} )
|
||||||
(?= [[\)!,:;./\s]|$)
|
(?= [[\)!,:;./\s]|$)
|
||||||
]]>, "gx");
|
]]>, "gx");
|
||||||
return this.highlightSubstrings(str, (function () {
|
return this.highlightSubstrings(str, (function () {
|
||||||
|
|||||||
@@ -620,7 +620,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
range.selectNode(node);
|
range.selectNode(node);
|
||||||
node = range;
|
node = range;
|
||||||
}
|
}
|
||||||
let doc = (node.getRangeAt ? node.getRangeAt(0) : node).startContainer.ownerDocument;
|
let doc = (node.getRangeAt ? node.getRangeAt(0) : node).startContainer;
|
||||||
|
doc = doc.ownerDocument || doc;
|
||||||
|
|
||||||
let encoder = services.HtmlEncoder();
|
let encoder = services.HtmlEncoder();
|
||||||
encoder.init(doc, "text/unicode", encoder.OutputRaw|encoder.OutputPreformatted);
|
encoder.init(doc, "text/unicode", encoder.OutputRaw|encoder.OutputPreformatted);
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
- Added site-specific mapping groups and related command
|
- Added site-specific mapping groups and related command
|
||||||
changes. [b6]
|
changes. [b6]
|
||||||
- Added 'timeout' and 'timeoutlen' options. [b6]
|
- Added 'timeout' and 'timeoutlen' options. [b6]
|
||||||
|
- Added n_{, n_}, n_[, and n_] mappings. [b7]
|
||||||
- Added <A-b> to execute a builtin mapping. [b6]
|
- Added <A-b> to execute a builtin mapping. [b6]
|
||||||
- Added <A-m>l and <A-m>s to aid in the construction of
|
- Added <A-m>l and <A-m>s to aid in the construction of
|
||||||
macros. [b6]
|
macros. [b6]
|
||||||
@@ -185,11 +186,13 @@
|
|||||||
- Added 'autocomplete' option for specifying which completion
|
- Added 'autocomplete' option for specifying which completion
|
||||||
groups should be auto-completed. [b2]
|
groups should be auto-completed. [b2]
|
||||||
- Added 'banghist' option. [b1]
|
- Added 'banghist' option. [b1]
|
||||||
|
- Added 'cookies', 'cookieaccept', and 'cookielifetime' options. [b3]
|
||||||
- Added 'downloadsort' option. [b7]
|
- Added 'downloadsort' option. [b7]
|
||||||
- Replaced 'focuscontent' with 'strictfocus'. [b1]
|
- Replaced 'focuscontent' with 'strictfocus'. [b1]
|
||||||
- Made 'strictfocus' a [sitemap]. [b7]
|
- Made 'strictfocus' a [sitemap]. [b7]
|
||||||
- 'complete' now defaults to "slf" but file completion only
|
- 'complete' now defaults to "slf" but file completion only
|
||||||
triggers when the URL begins as above. [b1]
|
triggers when the URL begins as above. [b1]
|
||||||
|
- Added 'jumptags' option. [b7]
|
||||||
- Added 's' flag to 'pageinfo' and changed default value. [b7]
|
- Added 's' flag to 'pageinfo' and changed default value. [b7]
|
||||||
- Added 'passkeys' option. [b3]
|
- Added 'passkeys' option. [b3]
|
||||||
- Added 'passunknown' option. [b7]
|
- Added 'passunknown' option. [b7]
|
||||||
@@ -197,7 +200,6 @@
|
|||||||
- Added "passwords" and "venkman" dialogs to :dialog. [b2]
|
- Added "passwords" and "venkman" dialogs to :dialog. [b2]
|
||||||
- Make 'showmode' a [stringlist] option. [b7]
|
- Make 'showmode' a [stringlist] option. [b7]
|
||||||
- Added 'wildanchor' option. [b2]
|
- Added 'wildanchor' option. [b2]
|
||||||
- Added 'cookies', 'cookieaccept', and 'cookielifetime' options. [b3]
|
|
||||||
• Added BookmarkChange, BookmarkRemove autocommands. [b2]
|
• Added BookmarkChange, BookmarkRemove autocommands. [b2]
|
||||||
• Removed the :source line at the end of files generated by
|
• Removed the :source line at the end of files generated by
|
||||||
:mkpentadactylrc. [b2]
|
:mkpentadactylrc. [b2]
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ FEATURES:
|
|||||||
8 all search commands should start searching from the top of the visible viewport
|
8 all search commands should start searching from the top of the visible viewport
|
||||||
8 <C-o>/<C-i> should work as in Vim (i.e., save page positions as well as
|
8 <C-o>/<C-i> should work as in Vim (i.e., save page positions as well as
|
||||||
locations in the history list).
|
locations in the history list).
|
||||||
8 jump to the next heading with ]h, next image ]i, previous textbox [t and so on
|
|
||||||
7 clean up error message codes and document
|
7 clean up error message codes and document
|
||||||
7 add search capability to MOW
|
7 add search capability to MOW
|
||||||
7 describe-key command (prompt for a key and display its binding with documentation)
|
7 describe-key command (prompt for a key and display its binding with documentation)
|
||||||
@@ -62,7 +61,6 @@ FEATURES:
|
|||||||
5 make a command to search within google search results
|
5 make a command to search within google search results
|
||||||
(http://gadelkareem.com/2007/01/28/using-google-ajax-api-as-an-array/)
|
(http://gadelkareem.com/2007/01/28/using-google-ajax-api-as-an-array/)
|
||||||
maybe impossible, needs a per-site key from google
|
maybe impossible, needs a per-site key from google
|
||||||
4 } { should jump to the next paragraph of the page
|
|
||||||
3 A format for 'guitablabel' and 'statusline'
|
3 A format for 'guitablabel' and 'statusline'
|
||||||
3 add a command-line window (:help cmdline-window in Vim).
|
3 add a command-line window (:help cmdline-window in Vim).
|
||||||
3 Splitting Windows with [:sp :vsp ctrl-w,s ctrl-w,v] and closing with [ctrl-w,q], moving with [ctrl-w,w or tab]
|
3 Splitting Windows with [:sp :vsp ctrl-w,s ctrl-w,v] and closing with [ctrl-w,q], moving with [ctrl-w,w or tab]
|
||||||
|
|||||||
Reference in New Issue
Block a user