- commit
- e076b416c7acd504e67bcc4bebd62bd4189d9d8e
- parent
- 8261bb80c83c244657e302fa147cd9757ee1f773
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-12-09 09:52
consider end in apply
Diffstat
M | static/diff.js | 2 | +- |
1 files changed, 1 insertions, 1 deletions
diff --git a/static/diff.js b/static/diff.js
@@ -21,7 +21,7 @@ export var apply = function(text, [start, end, before, after], selection) { 21 21 var best = -1; 22 22 var bestDist = Infinity; 23 23 for (var i = text.indexOf(before); i !== -1; i = text.indexOf(before, i + 1)) {24 -1 var dist = Math.abs(i - start);-1 24 var dist = Math.abs(i - start) + Math.abs(i + before.length + end - text.length); 25 25 if (dist < bestDist) { 26 26 best = i; 27 27 bestDist = dist;