Skip to content

Commit

Permalink
fix: tabs sorting by title: natural numerical sorting (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbnuqw committed Mar 4, 2024
1 parent 403f33d commit 0ef59a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/tabs.fg.sorting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export async function sort(type: By, ids: ID[], dir = 0, tree?: boolean) {

// Sort by title
if (type === By.Title) {
const collatorOptions = { numeric: true }
await sortTabsInChunks(sortingChunks, (aId, bId) => {
const aTab = Tabs.byId[aId]
const bTab = Tabs.byId[bId]
Expand All @@ -78,8 +79,8 @@ export async function sort(type: By, ids: ID[], dir = 0, tree?: boolean) {
if (Settings.state.sortGroupsFirst && aTab.isGroup !== bTab.isGroup) {
return aTab.isGroup ? -1 : 1
}
if (dir > 0) return aTitle.localeCompare(bTitle)
else return bTitle.localeCompare(aTitle)
if (dir > 0) return aTitle.localeCompare(bTitle, undefined, collatorOptions)
else return bTitle.localeCompare(aTitle, undefined, collatorOptions)
}).catch(() => {})
}

Expand Down

0 comments on commit 0ef59a8

Please sign in to comment.