Merge pull request #1207 from scde/patch-1

Reapply PR #1150 "Only cycle through visible tabs"
This commit is contained in:
Oliver Blanthorn 2018-12-04 13:57:32 +00:00 committed by GitHub
commit 3a5e74e518
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 })