From a281869bba0e3f52fa774ec431edccaba40d8a33 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 1 Feb 2018 11:43:29 +0100 Subject: [PATCH] make things actually work --- customize.dist/delta-words.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/customize.dist/delta-words.js b/customize.dist/delta-words.js index 74f93b918..4eec0d0b3 100644 --- a/customize.dist/delta-words.js +++ b/customize.dist/delta-words.js @@ -24,23 +24,23 @@ define([ return offset; }; - var opsToWords = function (last, current) { + var opsToWords = function (previous, current) { var output = []; - Diff.diff(A, B).forEach(function (op) { + Diff.diff(previous, current).forEach(function (op) { // ignore deleted sections... var offset = op.offset; var toInsert = op.toInsert; // given an operation, check whether it is a word fragment, // if it is, expand it to its word boundaries - var first = B.slice(leadingBoundary(B, offset), offset); - var last = B.slice(offset + toInsert.length, trailingBoundary(B, offset + toInsert.length)); + var first = current.slice(leadingBoundary(current, offset), offset); + var last = current.slice(offset + toInsert.length, trailingBoundary(current, offset + toInsert.length)); var result = first + toInsert + last; // concat-in-place Array.prototype.push.apply(output, result.split(/\s+/)); }); - return output; + return output.filter(Boolean); }; var runningDiff = function (getter, f, time) {