1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 19:57:58 +01:00

better :q

This commit is contained in:
Martin Stubenschrott
2007-10-17 20:34:08 +00:00
parent 800d76f031
commit 9f0b1964eb
7 changed files with 25 additions and 5 deletions

View File

@@ -1350,8 +1350,9 @@ function Commands() //{{{
addDefaultCommand(new Command(["q[uit]"],
function() { vimperator.tabs.remove(getBrowser().mCurrentTab, 1, false, 1); },
{
short_help: "Quit current tab or quit Vimperator if this was the last tab",
help: "When quitting Vimperator, the session is not stored."
short_help: "Quit current tab",
help: "If this is the last tab in the window, close the window. If this was the " +
"last window, close Vimperator. When quitting Vimperator, the session is not stored."
}
));
addDefaultCommand(new Command(["quita[ll]", "qa[ll]"],

View File

@@ -172,8 +172,12 @@ function Tabs() //{{{
count = 1;
if (quit_on_last_tab >= 1 && getBrowser().mTabs.length <= count)
vimperator.quit(quit_on_last_tab == 2);
{
if (vimperator.windows.length > 1)
window.close();
else
vimperator.quit(quit_on_last_tab == 2);
}
var index = this.index(tab);
if (focus_left_tab)

View File

@@ -812,8 +812,17 @@ const vimperator = (function() //{{{
for (; now - then < ms; now = new Date().getTime()) {
mainThread.processNextEvent(true);
}
}
},
get windows()
{
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
var wa = [];
var enumerator = wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements())
wa.push(enumerator.getNext());
return wa;
}
} //}}}
})(); //}}}