Merge pull request #44 from ueokande/fix-37

Fix tab selection
jh-changes
Shin'ya Ueoka 7 years ago committed by GitHub
commit 01dfb15654
  1. 4
      src/background/tabs.js

@ -62,7 +62,7 @@ const selectPrevTab = (current, count) => {
if (tabs.length < 2) { if (tabs.length < 2) {
return; return;
} }
let select = (current - count) % tabs.length; let select = (current - count + tabs.length) % tabs.length;
let id = tabs[select].id; let id = tabs[select].id;
return browser.tabs.update(id, { active: true }); return browser.tabs.update(id, { active: true });
}); });
@ -73,7 +73,7 @@ const selectNextTab = (current, count) => {
if (tabs.length < 2) { if (tabs.length < 2) {
return; return;
} }
let select = (current + count + tabs.length) % tabs.length; let select = (current + count) % tabs.length;
let id = tabs[select].id; let id = tabs[select].id;
return browser.tabs.update(id, { active: true }); return browser.tabs.update(id, { active: true });
}); });