From 223f6f79146dc0bb5b2084d12b207997a3b68c4b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 8 Jan 2016 13:25:03 +0000 Subject: [PATCH] Fix sorting of search result highlights Make sure that we *actually* give preference to longer search result highlights; it turns out that the code that looked like it was doing so has never worked. --- src/components/structures/RoomView.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 9ab99d9cba..5cffefad26 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -553,7 +553,8 @@ module.exports = React.createClass({ // For overlapping highlights, // favour longer (more specific) terms first - highlights = highlights.sort(function(a, b) { b.length - a.length }); + highlights = highlights.sort(function(a, b) { + return b.length - a.length }); self.setState({ searchHighlights: highlights,