From 22b3ba93ce3d6bbb9435cc71c2d026f31cc190da Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Tue, 18 Aug 2015 20:23:34 +0500 Subject: [PATCH] fix of #markout chars position data collecting --- js/twister_formatpost.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index af8ae1a..d908a39 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -402,14 +402,19 @@ function htmlFormatMsg(msg) { if (i !== 0) { l = kindOfL(i - 1); + } else { + l = 0; } if (j !== msg.str.length) { r = kindOfR(j); + } else { + r = 0; } - if (i === 0 || l === -10) { + + if ((i === 0 && r < 0) || l === -10) { p.push({i: i, k: j - i, t: -1, w: w, a: -1, p: -1}); w = false; - } else if (j === msg.str.length || r === -10) { + } else if ((j === msg.str.length && l < 0) || r === -10) { p.push({i: i, k: j - i, t: 1, w: w, a: -1, p: -1}); w = false; } else {