mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 17:57:59 +01:00
:back! and :forward! support
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
<pre>
|
<pre>
|
||||||
date:
|
date:
|
||||||
* version 0.4
|
* version 0.4
|
||||||
|
* :back! goes to beginning of history now
|
||||||
|
* diabled firefox 3.0 support for now, as there are just too many small
|
||||||
|
bugs
|
||||||
* :help <section> supported, :help set will show help for the :set command
|
* :help <section> supported, :help set will show help for the :set command
|
||||||
(patch from Viktor Kojouharov)
|
(patch from Viktor Kojouharov)
|
||||||
* :source support, and auto-sourcing ~/.vimperatorrc on startup
|
* :source support, and auto-sourcing ~/.vimperatorrc on startup
|
||||||
|
|||||||
@@ -47,8 +47,9 @@ var g_commands = [/*{{{*/
|
|||||||
[
|
[
|
||||||
["back", "ba"],
|
["back", "ba"],
|
||||||
"Go back in the browser history",
|
"Go back in the browser history",
|
||||||
"Count is supported, <code>:3back</code> goes back 3 pages in the browser history.",
|
"Count is supported, <code>:3back</code> goes back 3 pages in the browser history.<br>"+
|
||||||
function(args, special, count) { stepInHistory(count > 0 ? -1 * count : -1); },
|
"The special version <code>:back!</code> goes to the beginning of the browser history.",
|
||||||
|
function(args, special, count) { if(special) historyGoToBeginning(); else stepInHistory(count > 0 ? -1 * count : -1); },
|
||||||
null
|
null
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -145,8 +146,9 @@ var g_commands = [/*{{{*/
|
|||||||
[
|
[
|
||||||
["forward", "fw"],
|
["forward", "fw"],
|
||||||
"Go forward in the browser history",
|
"Go forward in the browser history",
|
||||||
"Count is supported, <code>:3forward</code> goes forward 3 pages in the browser history.",
|
"Count is supported, <code>:3forward</code> goes forward 3 pages in the browser history.<br>"+
|
||||||
function(count) { stepInHistory(count > 0 ? count : 1); },
|
"The special version <code>:back!</code> goes to the beginning of the browser history.",
|
||||||
|
function(args, special, count) { if(special) historyGoToEnd(); else stepInHistory(count > 0 ? count : 1); },
|
||||||
null
|
null
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -964,23 +966,41 @@ function echoerr(msg)
|
|||||||
function stepInHistory(steps)
|
function stepInHistory(steps)
|
||||||
{
|
{
|
||||||
var index = getWebNavigation().sessionHistory.index + steps;
|
var index = getWebNavigation().sessionHistory.index + steps;
|
||||||
if (index >= 0 && index < getWebNavigation().sessionHistory.count) {
|
if (index >= 0 && index < getWebNavigation().sessionHistory.count)
|
||||||
|
{
|
||||||
getWebNavigation().gotoIndex(index);
|
getWebNavigation().gotoIndex(index);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
beep();
|
beep();
|
||||||
if(index<0)
|
if(index<0)
|
||||||
echo("Already at beginning of history");
|
echo("Cannot go past beginning of history");
|
||||||
else
|
else
|
||||||
echo("Already at end of history");
|
echo("Cannot go past end of history");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function historyGoToBeginning()
|
||||||
function goUp() // FIXME
|
|
||||||
{
|
{
|
||||||
|
var index = getWebNavigation().sessionHistory.index;
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
echo("Already at beginning of history");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getWebNavigation().gotoIndex(0);
|
||||||
}
|
}
|
||||||
|
function historyGoToEnd()
|
||||||
|
{
|
||||||
|
var index = getWebNavigation().sessionHistory.index;
|
||||||
|
var max = getWebNavigation().sessionHistory.count -1;
|
||||||
|
if (index == max)
|
||||||
|
{
|
||||||
|
echo("Already at end of history");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getWebNavigation().gotoIndex(max);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user