From 12c5328dbb2a7433cfebe07c5ad7537c0036718d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 23 Nov 2017 09:32:44 +0100 Subject: [PATCH] hide_blockquote: Fix counting of lines in multi-level quoted text --- plugins/hide_blockquote/hide_blockquote.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/hide_blockquote/hide_blockquote.js b/plugins/hide_blockquote/hide_blockquote.js index e40956738..e938b33e9 100644 --- a/plugins/hide_blockquote/hide_blockquote.js +++ b/plugins/hide_blockquote/hide_blockquote.js @@ -26,9 +26,15 @@ function hide_blockquote() return; $('div.message-part div.pre > blockquote', $('#messagebody')).each(function() { - var div, link, q = $(this), - text = $.trim(q.text()), - res = text.split(/\n/); + var res, text, div, link, q = $(this); + + // Add new-line character before each blockquote + // This fixes counting lines of text, it also prevents + // from merging lines from different quoting level + $('blockquote').before(document.createTextNode("\n")); + + text = $.trim(q.text()); + res = text.split(/\n/); if (res.length <= limit) { // there can be also a block with very long wrapped line