From 495088ec00f711f576612e0c3db1fec649134c83 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 5 Oct 2015 12:07:26 +0200 Subject: Fix editor activity reporting --- js/codeq/robot.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'js/codeq/robot.js') diff --git a/js/codeq/robot.js b/js/codeq/robot.js index 8854855..11b91cf 100644 --- a/js/codeq/robot.js +++ b/js/codeq/robot.js @@ -146,14 +146,17 @@ editor.on('change', function (instance, changeObj) { var doc = editor.getDoc(), - pos = codeq.codePointCount(doc.getRange(firstCharacterPos, changeObj.from)); + pos = codeq.codePointCount(doc.getRange(firstCharacterPos, changeObj.from)), + text; - if (changeObj.removed) { - activityHandler.queueTrace({'typ': 'rm', 'off': pos, 'len': codeq.codePointCount(changeObj.removed.join(''))}); + text = changeObj.removed.join('\n'); + if (text) { + activityHandler.queueTrace({'typ': 'rm', 'off': pos, 'txt': text}); } - if (changeObj.text) { - activityHandler.queueTrace({'typ': 'ins', 'off': pos, 'txt': changeObj.text}); + text = changeObj.text.join('\n'); + if (text) { + activityHandler.queueTrace({'typ': 'ins', 'off': pos, 'txt': text}); } }); -- cgit v1.2.1