From 81eb2d92da531618638983f9cebf48d508e2ac54 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Sun, 14 Oct 2007 10:28:14 +0000 Subject: [PATCH] beep if trying to delete the last tab which is already an empty tab --- content/events.js | 8 +++++--- content/tabs.js | 10 ++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/content/events.js b/content/events.js index 0110ae03..07bd59d7 100644 --- a/content/events.js +++ b/content/events.js @@ -748,11 +748,13 @@ function Events() //{{{ if (key != "" && key != "") { - stop = false; // command was not a vimperator command, maybe it is a firefox command + // allow key to be passed to firefox if we can't handle it + stop = false; // TODO: see if this check is needed or are all motion commands already mapped in these modes? - if (vimperator.mode != vimperator.modes.INSERT && vimperator.mode != vimperator.modes.COMMAND_LINE) - vimperator.beep(); + if (vimperator.mode != vimperator.modes.INSERT && + vimperator.mode != vimperator.modes.COMMAND_LINE) + vimperator.beep(); } } diff --git a/content/tabs.js b/content/tabs.js index 37b75f78..e0e25d7c 100644 --- a/content/tabs.js +++ b/content/tabs.js @@ -157,8 +157,14 @@ function Tabs() //{{{ getBrowser().removeTab(tab); else { - vimperator.open("about:blank", vimperator.NEW_BACKGROUND_TAB); - getBrowser().removeTab(tab); + if (vimperator.buffer.URL != "about:blank" || + getWebNavigation().sessionHistory.count > 0) + { + vimperator.open("about:blank", vimperator.NEW_BACKGROUND_TAB); + getBrowser().removeTab(tab); + } + else + vimperator.beep(); } }