1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 11:18:00 +01:00
This commit is contained in:
Kris Maglione
2011-08-07 15:35:35 -04:00
parent 6739ab0ef0
commit ac29e49b3d
4 changed files with 22 additions and 4 deletions

View File

@@ -820,8 +820,9 @@ var Buffer = Module("buffer", {
* @param {number} count The number of elements to jump.
* @optional
* @param {boolean} reverse If true, search backwards. @optional
* @param {boolean} offScreen If true, include only off-screen elements. @optional
*/
findJump: function findJump(arg, count, reverse) {
findJump: function findJump(arg, count, reverse, offScreen) {
const FUDGE = 10;
let path = options["jumptags"][arg];
@@ -832,6 +833,9 @@ var Buffer = Module("buffer", {
.filter(function (e) e[1] > FUDGE)
.sort(function (a, b) a[1] - b[1])
if (offScreen && !reverse)
elems = elems.filter(function (e) e[1] > this, window.innerHeight);
let idx = Math.min((count || 1) - 1, elems.length);
dactyl.assert(idx in elems);
@@ -1840,6 +1844,11 @@ var Buffer = Module("buffer", {
function (args) { buffer.findJump(args.arg, args.count, true); },
{ arg: true, count: true });
mappings.add([modes.NORMAL], ["g]"],
"Jump to the next off-screen element as defined by 'jumptags'",
function (args) { buffer.findJump(args.arg, args.count, false, 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); },

View File

@@ -171,10 +171,10 @@ var Marks = Module("marks", {
var node = buffer.findScrollable(0, (mark.offset || mark.position).x)
else
for (node in util.evaluateXPath(mark.xpath, buffer.focusedFrame.document))
;
break;
util.assert(node);
util.scrollIntoView(node, true);
util.scrollIntoView(node);
if (mark.position)
Buffer.scrollToPercent(node, mark.position.x * 100, mark.position.y * 100);

View File

@@ -344,6 +344,15 @@
</description>
</item>
<item>
<tags>g]</tags>
<spec><oa>count</oa>]<a>arg</a></spec>
<description short="true">
<p>Jump to the next off-screen element as defined by <o>jumptags</o>.</p>
</description>
</item>
<item>
<tags>{</tags>
<spec><oa>count</oa>{</spec>

View File

@@ -81,7 +81,7 @@
- Added site-specific mapping groups and related command
changes. [b6]
- Added 'timeout' and 'timeoutlen' options. [b6]
- Added n_{, n_}, n_[, and n_] mappings. [b7]
- Added n_{, n_}, n_[, n_], and n_g] mappings. [b7]
- Added <A-b> to execute a builtin mapping. [b6]
- Added <A-m>l and <A-m>s to aid in the construction of
macros. [b6]