mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-25 00:58:08 -05:00
Sort lists with localeCompare
The difference in case sensitivity is the most obvious change with servers like soju that support CASEMAPPING ascii and rfc1459. Currently the list: 'Alpha', 'aardvark', 'Charlie', 'comma' currently sorts to: 'Alpha', 'Charlie', 'aardvark', 'comma' with this change it will instead become: 'aardvark', 'Alpha', 'Charlie', 'comma' If something like RFC 7613 gets broader support then there are a few more differences for a list like: 'éclair', 'ecstatic, 'aardvark', 'zed', 'Gamma' currently sorts to: 'Gamma', 'aardvark', 'ecstatic', 'zed', 'éclair' with this patch would instead sort to: 'aardvark', 'éclair', 'ecstatic', 'Gamma', 'zed' The above examples were run with a locale unspecified which fell back to my browser/host default of 'en'.
This commit is contained in:
parent
a2d2a11d44
commit
096fcbf829
2 changed files with 2 additions and 2 deletions
|
@ -101,7 +101,7 @@ function sortMembers(a, b) {
|
|||
return i - j;
|
||||
}
|
||||
|
||||
return nickA < nickB ? -1 : 1;
|
||||
return nickA.localeCompare(nickB);
|
||||
}
|
||||
|
||||
export default class MemberList extends Component {
|
||||
|
|
2
state.js
2
state.js
|
@ -157,7 +157,7 @@ function compareBuffers(a, b) {
|
|||
return isServerBuffer(b) ? 1 : -1;
|
||||
}
|
||||
if (a.name != b.name) {
|
||||
return a.name > b.name ? 1 : -1;
|
||||
return a.name.localeCompare(b.name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue