aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-05-10 22:04:42 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-05-12 09:10:18 +0900
commit9b3d12eb31483898dd3ae527a31dd6602f79e718 (patch)
tree56081cba405162fdf37d54be8889be1485ff1a93 /src
parentc4fb6f01319ca2d0cb71da2f3ed41de1ff35130c (diff)
Add bdeletes! comand
Diffstat (limited to 'src')
-rw-r--r--src/background/actions/command.js2
-rw-r--r--src/background/shared/completions/index.js1
-rw-r--r--src/background/shared/tabs.js10
3 files changed, 12 insertions, 1 deletions
diff --git a/src/background/actions/command.js b/src/background/actions/command.js
index 020a57f..fa040ff 100644
--- a/src/background/actions/command.js
+++ b/src/background/actions/command.js
@@ -86,6 +86,8 @@ const exec = (tab, line, settings) => {
return bufferCommand(args);
case 'bdeletes':
return tabs.closeTabsByKeywords(args.join(' '));
+ case 'bdeletes!':
+ return tabs.closeTabsByKeywordsForce(args.join(' '));
case 'addbookmark':
return addBookmarkCommand(tab, args).then((item) => {
if (!item) {
diff --git a/src/background/shared/completions/index.js b/src/background/shared/completions/index.js
index 43af23d..77394bc 100644
--- a/src/background/shared/completions/index.js
+++ b/src/background/shared/completions/index.js
@@ -89,6 +89,7 @@ const getCompletions = (line, settings) => {
case 'b':
case 'buffer':
case 'bdeletes':
+ case 'bdeletes!':
return tabs.getCompletions(keywords).then((gotTabs) => {
let items = gotTabs.map((tab) => {
return {
diff --git a/src/background/shared/tabs.js b/src/background/shared/tabs.js
index 1e5e3e4..c90ac4b 100644
--- a/src/background/shared/tabs.js
+++ b/src/background/shared/tabs.js
@@ -14,6 +14,13 @@ const closeTabForce = (id) => {
const closeTabsByKeywords = (keyword) => {
tabCompletions.getCompletions(keyword).then((tabs) => {
+ let tabs2 = tabs.filter(tab => !tab.pinned);
+ browser.tabs.remove(tabs2.map(tab => tab.id));
+ });
+};
+
+const closeTabsByKeywordsForce = (keyword) => {
+ tabCompletions.getCompletions(keyword).then((tabs) => {
browser.tabs.remove(tabs.map(tab => tab.id));
});
};
@@ -127,7 +134,8 @@ const duplicate = (id) => {
};
export {
- closeTab, closeTabForce, closeTabsByKeywords, reopenTab, selectAt, selectByKeyword,
+ closeTab, closeTabForce, closeTabsByKeywords, closeTabsByKeywordsForce,
+ reopenTab, selectAt, selectByKeyword,
selectPrevTab, selectNextTab, selectFirstTab,
selectLastTab, selectTab, reload, updateTabPinned,
toggleTabPinned, duplicate