From 7240bbbf4460092528ec8f25d835bd597c5a817c Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Tue, 3 Nov 2020 00:03:00 +0100 Subject: [PATCH] entity sort offset+length --- qml/js/functions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/js/functions.js b/qml/js/functions.js index 27d48f1..d950b7d 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -253,7 +253,7 @@ function enhanceMessageText(formattedText) { } } - messageInsertions.sort( function(a, b) { return b.offset - a.offset } ); + messageInsertions.sort( function(a, b) { return (b.offset+b.removeLength) - (a.offset+a.removeLength) } ); for (var z = 0; z < messageInsertions.length; z++) { messageText = messageText.substring(0, messageInsertions[z].offset) + messageInsertions[z].insertionString + messageText.substring(messageInsertions[z].offset + messageInsertions[z].removeLength);