1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-28 09:25:47 +01:00

More comprehensive :jumps.

This commit is contained in:
Kris Maglione
2011-10-20 06:04:10 -04:00
parent 419d9b61f8
commit 933f490817
5 changed files with 42 additions and 8 deletions

View File

@@ -382,14 +382,6 @@ var Bookmarks = Module("bookmarks", {
}, { }, {
}, { }, {
commands: function () { commands: function () {
commands.add(["ju[mps]"],
"Show jumplist",
function () {
let sh = history.session;
commandline.commandOutput(template.jumps(sh.index, sh));
},
{ argCount: "0" });
// TODO: Clean this up. // TODO: Clean this up.
const tags = { const tags = {
names: ["-tags", "-T"], names: ["-tags", "-T"],

View File

@@ -293,6 +293,33 @@ var History = Module("history", {
], ],
privateData: true privateData: true
}); });
commands.add(["ju[mps]"],
"Show jumplist",
function () {
let sh = history.session;
let index = sh.index;
let jumps = marks.jumps;
if (jumps.index < 0)
jumps = [sh[sh.index]];
else {
index += jumps.index;
jumps = jumps.locations.map(function (l) ({
__proto__: l,
title: buffer.title,
get URI() util.newURI(this.location)
}));
}
let list = sh.slice(0, sh.index)
.concat(jumps)
.concat(sh.slice(sh.index + 1));
commandline.commandOutput(template.jumps(index, list));
},
{ argCount: "0" });
}, },
completion: function () { completion: function () {
completion.domain = function (context) { completion.domain = function (context) {

View File

@@ -133,6 +133,14 @@ var Marks = Module("marks", {
}); });
}, },
get jumps() {
let store = buffer.localStore;
return {
index: store.jumpsIndex,
locations: store.jumps.map(function (j) j.mark)
};
},
/** /**
* Remove all marks matching *filter*. If *special* is given, removes all * Remove all marks matching *filter*. If *special* is given, removes all
* local marks. * local marks.

View File

@@ -344,6 +344,9 @@ title.Totals = Totals
title.URI = URI title.URI = URI
title.Version = Version title.Version = Version
title.HPos = HPos
title.VPos = VPos
variable.none = No variables found variable.none = No variables found
window.cantAttachSame = Can't reattach to the same window window.cantAttachSame = Can't reattach to the same window

View File

@@ -392,6 +392,8 @@ var Template = Module("Template", {
return <table> return <table>
<tr style="text-align: left;" highlight="Title"> <tr style="text-align: left;" highlight="Title">
<th colspan="2">{_("title.Jump")}</th> <th colspan="2">{_("title.Jump")}</th>
<th>{_("title.HPos")}</th>
<th>{_("title.VPos")}</th>
<th>{_("title.Title")}</th> <th>{_("title.Title")}</th>
<th>{_("title.URI")}</th> <th>{_("title.URI")}</th>
</tr> </tr>
@@ -400,6 +402,8 @@ var Template = Module("Template", {
<tr> <tr>
<td class="indicator">{idx == index ? ">" : ""}</td> <td class="indicator">{idx == index ? ">" : ""}</td>
<td>{Math.abs(idx - index)}</td> <td>{Math.abs(idx - index)}</td>
<td>{val.offset ? val.offset.x : ""}</td>
<td>{val.offset ? val.offset.y : ""}</td>
<td style="width: 250px; max-width: 500px; overflow: hidden;">{val.title}</td> <td style="width: 250px; max-width: 500px; overflow: hidden;">{val.title}</td>
<td><a href={val.URI.spec} highlight="URL jump-list">{util.losslessDecodeURI(val.URI.spec)}</a></td> <td><a href={val.URI.spec} highlight="URL jump-list">{util.losslessDecodeURI(val.URI.spec)}</a></td>
</tr>) </tr>)