mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 08:27:58 +01:00
count support for deleting buffers
This commit is contained in:
1
NEWS
1
NEWS
@@ -2,6 +2,7 @@
|
||||
2007-xx-xx:
|
||||
* version 0.6
|
||||
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0
|
||||
* "d", "D" and :bdelete support count now
|
||||
* :back/:forward can use tabcompletion
|
||||
* :undoall support, and tabcompletion for :undo <tab>
|
||||
* new :redraw and Ctrl-L commands for forced redrawing of the screen
|
||||
|
||||
1
TODO
1
TODO
@@ -24,7 +24,6 @@ FEATURES:
|
||||
7 use ctrl-n/p in insert mode for word completion
|
||||
7 [ctrl-o/i] to Go back to a Previous Position (done partly, however currenty does not use a per tab jumplist)
|
||||
7 whereever possible: get rid of dialogs and ask console-like dialog questions or write error prompts directly on the webpage or with :echo()
|
||||
7 3d should delete 3 tabs
|
||||
6 downloading of links to filesystem (:save <filename>)
|
||||
6 autocommands (BrowserStart, BrowserQuit, TabClose, TabOpen, TabChanged, PageLoaded, any more?)
|
||||
6 pipe selected text/link/website to an external command
|
||||
|
||||
@@ -282,7 +282,7 @@ function Commands() //{{{
|
||||
{
|
||||
usage: ["[count]bd[elete][!]"],
|
||||
short_help: "Delete current buffer (=tab)",
|
||||
help: "Count WILL be supported in future releases, then <code class=\"command\">:2bd</code> removes two tabs and the one to the right is selected.<br/>Do <code class=\"command\">:bdelete!</code> to select the tab to the left after removing the current tab."
|
||||
help: "Count is supported, <code class=\"command\">:2bd</code> removes two tabs and the one to the right is selected.<br/>Do <code class=\"command\">:bdelete!</code> to select the tab to the left after removing the current tab."
|
||||
}
|
||||
));
|
||||
addDefaultCommand(new Command(["beep"],
|
||||
|
||||
@@ -423,7 +423,8 @@ function Mappings() //{{{
|
||||
function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, false, 0); },
|
||||
{
|
||||
short_help: "Delete current buffer (=tab)",
|
||||
help: "Count WILL be supported in future releases, then <code class=\"mapping\">2d</code> removes two tabs and the one the right is selected.",
|
||||
help: "Count is supported, <code class=\"mapping\">2d</code> removes the current and next tab and the one the right is selected. " +
|
||||
"Does not wrap if <code class=\"argument\">[count]</code> is larger than available tabs to the right.",
|
||||
flags: Mappings.flags.COUNT
|
||||
}
|
||||
));
|
||||
@@ -431,7 +432,8 @@ function Mappings() //{{{
|
||||
function(count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, true, 0); },
|
||||
{
|
||||
short_help: "Delete current buffer (=tab)",
|
||||
help: "Count WILL be supported in future releases, then <code class=\"mapping\">2d</code> removes two tabs and the one the right is selected.",
|
||||
help: "Count is supported, <code class=\"mapping\">2D</code> removes the current and previous tab and the one the left is selected. " +
|
||||
"Does not wrap if <code class=\"argument\">[count]</code> is larger than available tabs to the left.",
|
||||
flags: Mappings.flags.COUNT
|
||||
}
|
||||
));
|
||||
|
||||
@@ -151,15 +151,44 @@ function Tabs() //{{{
|
||||
*/
|
||||
this.remove = function(tab, count, focus_left_tab, quit_on_last_tab)
|
||||
{
|
||||
if (count < 1) count = 1;
|
||||
function removeOrBlankTab (tab)
|
||||
{
|
||||
if (getBrowser().mTabs.length > 1)
|
||||
getBrowser().removeTab(tab);
|
||||
else
|
||||
{
|
||||
vimperator.open("about:blank", vimperator.NEW_BACKGROUND_TAB);
|
||||
getBrowser().removeTab(tab);
|
||||
}
|
||||
}
|
||||
|
||||
if (count < 1)
|
||||
count = 1;
|
||||
|
||||
if (quit_on_last_tab >= 1 && getBrowser().mTabs.length <= count)
|
||||
vimperator.quit(quit_on_last_tab == 2);
|
||||
|
||||
if (focus_left_tab && tab.previousSibling)
|
||||
this.select("-1", false);
|
||||
|
||||
getBrowser().removeTab(tab);
|
||||
var index = this.index(tab);
|
||||
if (focus_left_tab)
|
||||
{
|
||||
var last_removed_tab = 0;
|
||||
for (var i = index; i > index - count && i >= 0; i--)
|
||||
{
|
||||
removeOrBlankTab(this.getTab(i));
|
||||
last_removed_tab = i > 0 ? i : 1;
|
||||
}
|
||||
getBrowser().mTabContainer.selectedIndex = last_removed_tab - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
var i = index + count - 1;
|
||||
if (i >= this.count())
|
||||
i = this.count() - 1;
|
||||
|
||||
for (; i >= index; i--)
|
||||
removeOrBlankTab(this.getTab(i));
|
||||
}
|
||||
}
|
||||
|
||||
this.keepOnly = function(tab)
|
||||
|
||||
@@ -1068,6 +1068,9 @@ function StatusLine() //{{{
|
||||
if (!url || typeof url != "string")
|
||||
url = vimperator.buffer.URL;
|
||||
|
||||
if (url == "about:blank")
|
||||
url = "[No Name]"; // make it even more vim-like
|
||||
|
||||
url_widget.value = url;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user