Fix bufferall selecting the wrong window.

The problem was that when calling sort on an array of numbers without
specifying the sort function that should be used, the array will be
sorted according to the lexicographic order of the elements.

This is fixed by specifying what function should be used to sort the
array.

This fixes https://github.com/cmcaine/tridactyl/issues/819.
This commit is contained in:
glacambre 2018-07-24 08:03:02 +02:00
parent 5b30812361
commit 96d0b20cc5
No known key found for this signature in database
GPG key ID: B9625DB1767553AC

View file

@ -2324,7 +2324,7 @@ export async function buffer(index: number | "#") {
*/
//#background
export async function bufferall(id: string) {
let windows = (await browser.windows.getAll()).map(w => w.id).sort()
let windows = (await browser.windows.getAll()).map(w => w.id).sort((a, b) => a - b)
if (id === null || id === undefined || !id.match(/\d+\.\d+/)) {
const tab = await activeTab()
let prevId = id