mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 12:17:58 +01:00
:undoall + :undo tab-completion
This commit is contained in:
1
NEWS
1
NEWS
@@ -2,6 +2,7 @@
|
|||||||
2007-xx-xx:
|
2007-xx-xx:
|
||||||
* version 0.6
|
* version 0.6
|
||||||
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0
|
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0
|
||||||
|
* :undoall support, and tabcompletion for :undo <tab>
|
||||||
* new :redraw and Ctrl-L commands for forced redrawing of the screen
|
* new :redraw and Ctrl-L commands for forced redrawing of the screen
|
||||||
* added new 'laststatus' option and removed "s" value from 'guioptions'
|
* added new 'laststatus' option and removed "s" value from 'guioptions'
|
||||||
* Tab-completion improvements for :javascript and :open
|
* Tab-completion improvements for :javascript and :open
|
||||||
|
|||||||
@@ -1506,13 +1506,62 @@ function Commands() //{{{
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
addDefaultCommand(new Command(["u[ndo]"],
|
addDefaultCommand(new Command(["u[ndo]"],
|
||||||
function(args, special, count) { if (count < 1) count = 1; undoCloseTab(count-1); },
|
function(args, special, count)
|
||||||
{
|
{
|
||||||
usage: ["[count]u[ndo]"],
|
if (count < 1)
|
||||||
|
count = 1;
|
||||||
|
|
||||||
|
if (args)
|
||||||
|
{
|
||||||
|
var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||||
|
var undoItems = eval("(" + ss.getClosedTabData(window) + ")");
|
||||||
|
for (var i = 0; i < undoItems.length; i++)
|
||||||
|
{
|
||||||
|
if (undoItems[i].state.entries[0].url == args)
|
||||||
|
{
|
||||||
|
count = i+1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
undoCloseTab(count-1);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
usage: ["[count]u[ndo][!] [url]"],
|
||||||
short_help: "Undo closing of a tab",
|
short_help: "Undo closing of a tab",
|
||||||
help: "If a count is given, don't close the last but the <code class=\"argument\">[count]</code>th last tab."
|
help: "If a count is given, don't close the last but the <code class=\"argument\">[count]</code>th last tab. " +
|
||||||
|
"With <code class=\"argument\">[url]</code> restores the tab matching the url.",
|
||||||
|
completer: function(filter)
|
||||||
|
{
|
||||||
|
// get closed-tabs from nsSessionStore
|
||||||
|
var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||||
|
var undoItems = eval("(" + ss.getClosedTabData(window) + ")");
|
||||||
|
var completions = [];
|
||||||
|
for (var i = 0; i < undoItems.length; i++)
|
||||||
|
{
|
||||||
|
// undoItems[i].image is also available if need for favicons
|
||||||
|
completions.push([undoItems[i].state.entries[0].url, undoItems[i].title]);
|
||||||
|
}
|
||||||
|
return completions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
addDefaultCommand(new Command(["undoa[ll]"],
|
||||||
|
function(args, special, count)
|
||||||
|
{
|
||||||
|
if (count || special)
|
||||||
|
return vimperator.echoerr("E488: Trailing characters");
|
||||||
|
|
||||||
|
var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||||
|
var undoItems = eval("(" + ss.getClosedTabData(window) + ")");
|
||||||
|
for (var i = 0; i < undoItems.length; i++)
|
||||||
|
undoCloseTab(); // doesn't work with i as the index to undoCloseTab
|
||||||
|
},
|
||||||
|
{
|
||||||
|
short_help: "Undo closing of all closed tabs",
|
||||||
|
help: "Firefox stores up to 10 closed tabs, even after a browser restart."
|
||||||
|
}
|
||||||
|
)),
|
||||||
addDefaultCommand(new Command(["unl[et]"],
|
addDefaultCommand(new Command(["unl[et]"],
|
||||||
function(args, special)
|
function(args, special)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user