Skip to content

Commit e96191b

Browse files
fix
1 parent b9fc8e1 commit e96191b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/core/src/parse/template.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ export const getSyntaxDiffTemplateByFastDiff = ({
241241
template += `</span>`;
242242
} else if (range.startIndex === range.endIndex) {
243243
template += `</span>`;
244+
}
245+
if (range.endIndex === index) {
244246
rangeIndex++;
245247
range = allRange[rangeIndex];
246248
}
@@ -255,8 +257,8 @@ export const getSyntaxDiffTemplateByFastDiff = ({
255257
? `<span data-diff-highlight style="background-color: var(${operator === "add" ? addContentHighlightBGName : delContentHighlightBGName});border-radius: 0.2em;">`
256258
: isEndInSameNode
257259
? `<span data-diff-highlight style="background-color: var(${operator === "add" ? addContentHighlightBGName : delContentHighlightBGName});border-top-right-radius: 0.2em;border-bottom-right-radius: 0.2em;">`
258-
// current range crosses the node boundary
259-
: `<span data-diff-highlight style="background-color: var(${operator === "add" ? addContentHighlightBGName : delContentHighlightBGName});">`;
260+
: // current range crosses the node boundary
261+
`<span data-diff-highlight style="background-color: var(${operator === "add" ? addContentHighlightBGName : delContentHighlightBGName});">`;
260262
}
261263
template += transform(value);
262264
if (isEndStr && changes.newLineSymbol) {

0 commit comments

Comments
 (0)