From 64694a63272247180584c144ecf62b988917f6e9 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 16 Oct 2010 15:55:14 -0400 Subject: [PATCH] Remove inane fourth argument from tabs.remove. --- common/content/dactyl.js | 6 ++++-- common/content/tabs.js | 23 ++++++----------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index b7880e54..92519683 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1719,8 +1719,10 @@ const Dactyl = Module("dactyl", { commands.add(["q[uit]"], dactyl.has("tabs") ? "Quit current tab" : "Quit application", function (args) { - if (dactyl.has("tabs")) - tabs.remove(config.browser.mCurrentTab, 1, false, 1); + if (dactyl.has("tabs") && tabs.remove(config.browser.mCurrentTab, 1, false)) + return; + else if (dactyl.windows.length > 1) + window.close(); else dactyl.quit(false, args.bang); }, { diff --git a/common/content/tabs.js b/common/content/tabs.js index ec843f25..6bb996a1 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -293,22 +293,10 @@ const Tabs = Module("tabs", { * @param {Object} tab The tab to remove. * @param {number} count How many tabs to remove. * @param {boolean} focusLeftTab Focus the tab to the left of the removed tab. - * @param {number} quitOnLastTab Whether to quit if the tab being - * deleted is the only tab in the tab list: - * 1 - quit without saving session - * 2 - quit and save session */ - // FIXME: what is quitOnLastTab {1,2} all about then, eh? --djk - remove: function (tab, count, focusLeftTab, quitOnLastTab) { + remove: function (tab, count, focusLeftTab) { count = count || 1; - - if (quitOnLastTab >= 1 && this.count <= count) { - if (dactyl.windows.length > 1) - window.close(); - else - dactyl.quit(quitOnLastTab == 2); - return; - } + let res = this.count > count; let tabs = this.visibleTabs; if (tabs.indexOf(tab) < 0) @@ -327,6 +315,7 @@ const Tabs = Module("tabs", { tabs.slice(Math.max(0, index + 1 - count), index + 1).forEach(config.removeTab); else tabs.slice(index, index + count).forEach(config.removeTab); + return res; }, /** @@ -557,7 +546,7 @@ const Tabs = Module("tabs", { dactyl.echoerr("E94: No matching tab for " + arg); } else // just remove the current tab - tabs.remove(tabs.getTab(), Math.max(count, 1), special, 0); + tabs.remove(tabs.getTab(), Math.max(count, 1), special); }, { argCount: "?", bang: true, @@ -945,12 +934,12 @@ const Tabs = Module("tabs", { mappings.add([modes.NORMAL], ["d"], "Delete current buffer", - function (count) { tabs.remove(tabs.getTab(), count, false, 0); }, + function (count) { tabs.remove(tabs.getTab(), count, false); }, { count: true }); mappings.add([modes.NORMAL], ["D"], "Delete current buffer, focus tab to the left", - function (count) { tabs.remove(tabs.getTab(), count, true, 0); }, + function (count) { tabs.remove(tabs.getTab(), count, true); }, { count: true }); mappings.add([modes.NORMAL], ["gb"],