Skip to content

Commit

Permalink
Prev Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
madprops committed Sep 17, 2024
1 parent ecf2939 commit b6eb0ff
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions js/main/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ App.unpin_tabs = (item) => {
App.unload_tabs = (item, multiple = true) => {
let items = []
let active = false
let selected = false

for (let it of App.get_active_items({mode: `tabs`, item: item, multiple: multiple})) {
if (it.unloaded) {
Expand All @@ -512,6 +513,10 @@ App.unload_tabs = (item, multiple = true) => {
active = true
}

if (it.selected) {
selected = true
}

items.push(it)
}

Expand All @@ -525,7 +530,7 @@ App.unload_tabs = (item, multiple = true) => {
App.show_confirm({
message: `Unload tabs? (${ids.length})`,
confirm_action: async () => {
if (active) {
if (active || selected) {
await App.swith_to_prev_tab(items, `unload`)
}

Expand All @@ -538,12 +543,17 @@ App.unload_tabs = (item, multiple = true) => {
App.close_tabs = (item, multiple = true) => {
let items = []
let active = false
let selected = false

for (let it of App.get_active_items({mode: `tabs`, item: item, multiple: multiple})) {
if (it.active) {
active = true
}

if (it.selected) {
selected = true
}

items.push(it)
}

Expand All @@ -557,7 +567,7 @@ App.close_tabs = (item, multiple = true) => {
App.show_confirm({
message: `Close tabs? (${items.length})`,
confirm_action: async () => {
if (active && smart_switch) {
if ((active || selected) && smart_switch) {
await App.swith_to_prev_tab(items, `close`)
}

Expand Down

0 comments on commit b6eb0ff

Please sign in to comment.