mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 07:17:59 +01:00
Add g].
This commit is contained in:
@@ -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); },
|
||||
|
||||
Reference in New Issue
Block a user