You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
When sorting completions, use matched string, not entire query
Otherwise the results vary depending on where you start autocompleting in your message. We only care about the matched string.
This commit is contained in:
@@ -63,9 +63,10 @@ export default class RoomProvider extends AutocompleteProvider {
|
||||
displayedAlias: getDisplayAliasForRoom(room),
|
||||
};
|
||||
}));
|
||||
completions = this.matcher.match(command[0]);
|
||||
const matchedString = command[0];
|
||||
completions = this.matcher.match(matchedString);
|
||||
completions = _sortBy(completions, [
|
||||
(c) => score(query, c.displayedAlias),
|
||||
(c) => score(matchedString, c.displayedAlias),
|
||||
(c) => c.displayedAlias.length,
|
||||
]).map((room) => {
|
||||
const displayAlias = getDisplayAliasForRoom(room.room) || room.roomId;
|
||||
|
||||
Reference in New Issue
Block a user