From 6b7108ba9ce9b871af77c9de30c23d0580ac35ea Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 16 Sep 2009 03:09:21 +1000 Subject: [PATCH] Display an error when calling :tabdetach on the only tab in a window. --- common/content/tabs.js | 8 +++++++- vimperator/locale/en-US/tabs.txt | 4 +++- xulmus/locale/en-US/tabs.txt | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/common/content/tabs.js b/common/content/tabs.js index b2d42b2f..1ad1b9eb 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -588,7 +588,13 @@ function Tabs() //{{{ commands.add(["tabde[tach]"], "Detach current tab to its own window", - function () { tabs.detachTab(null); }, + function () + { + if (tabs.count == 1) + return void liberator.echoerr("Can't detach the last tab"); + + tabs.detachTab(null); + }, { argCount: "0" }); commands.add(["tabdu[plicate]"], diff --git a/vimperator/locale/en-US/tabs.txt b/vimperator/locale/en-US/tabs.txt index 6887839f..ad7562ad 100644 --- a/vimperator/locale/en-US/tabs.txt +++ b/vimperator/locale/en-US/tabs.txt @@ -155,7 +155,9 @@ ________________________________________________________________________________ |:tabde| |:tabdetach| + ||:tabde[tach]|| ________________________________________________________________________________ -Detach the current tab, and open it in its own window. +Detach the current tab, and open it in its own window. As each window must +contain at least one tab it is not possible to detach the only tab in a window. +Use [c]:tabduplicate[c] to copy the tab then call [c]:tabdetach[c]. ________________________________________________________________________________ section::Reordering{nbsp}tabs[reordering-tabs] diff --git a/xulmus/locale/en-US/tabs.txt b/xulmus/locale/en-US/tabs.txt index c600d440..0fcf2bc6 100644 --- a/xulmus/locale/en-US/tabs.txt +++ b/xulmus/locale/en-US/tabs.txt @@ -146,7 +146,9 @@ ________________________________________________________________________________ |:tabde| |:tabdetach| + ||:tabde[tach]|| ________________________________________________________________________________ -Detach the current tab, and open it in its own window. +Detach the current tab, and open it in its own window. As each window must +contain at least one tab it is not possible to detach the only tab in a window. +Use [c]:tabduplicate[c] to copy the tab then call [c]:tabdetach[c]. ________________________________________________________________________________ section::Reordering{nbsp}tabs[reordering-tabs]