Reapply PR #1150 "Only cycle through visible tabs"

It seems the actual change in PR #1150 (a09a771) has been lost in its merge (6562699).

This should now actually fix Issue #1084 and ignore hidden tabs when cycling through tabs.
This commit is contained in:
scde 2018-12-04 12:55:56 +01:00 committed by GitHub
parent 10a6598c32
commit 9ad3e09c79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1704,7 +1704,7 @@ export async function tabprev(increment = 1) {
// Proper way:
// return tabIndexSetActive((await activeTab()).index - increment + 1)
// Kludge until https://bugzilla.mozilla.org/show_bug.cgi?id=1504775 is fixed:
return browser.tabs.query({ currentWindow: true }).then(tabs => {
return browser.tabs.query({ currentWindow: true, hidden: false }).then(tabs => {
tabs = tabs.sort((t1, t2) => t1.index - t2.index)
let prevTab = (tabs.findIndex(t => t.active) - increment + tabs.length) % tabs.length
return browser.tabs.update(tabs[prevTab].id, { active: true })