summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-08-07 15:35:35 -0400
committerKris Maglione <maglione.k@gmail.com>2011-08-07 15:35:35 -0400
commitac29e49b3dcea6d6d00fc612e51bacc02b0f657d (patch)
treeb1efeba7c23588efbbcaa38bad7aa921cd579e94 /common
parent6739ab0ef013c750e89497a84c9206aba56c62d2 (diff)
downloadpentadactyl-ac29e49b3dcea6d6d00fc612e51bacc02b0f657d.tar.gz
Add g].
Diffstat (limited to 'common')
-rw-r--r--common/content/buffer.js11
-rw-r--r--common/content/marks.js4
-rw-r--r--common/locale/en-US/buffer.xml9
3 files changed, 21 insertions, 3 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js
index 25c8cfed..279b3c94 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -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); },
diff --git a/common/content/marks.js b/common/content/marks.js
index 14683421..d0c7c252 100644
--- a/common/content/marks.js
+++ b/common/content/marks.js
@@ -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);
diff --git a/common/locale/en-US/buffer.xml b/common/locale/en-US/buffer.xml
index 7f514a91..40de0fe9 100644
--- a/common/locale/en-US/buffer.xml
+++ b/common/locale/en-US/buffer.xml
@@ -345,6 +345,15 @@
</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>
<description short="true">