Skip to content

Commit 0ec8ec8

Browse files
committed
fix: use regex to match only origin plain text
1 parent 1c494af commit 0ec8ec8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,10 @@ export function createSplitDiff(
273273

274274
const leftLine = curLines.length === nextLines.length ? renderWords(nextLine, curLine, diffStyle) : curLine
275275
const rightLine = curLines.length === nextLines.length ? renderWords(curLine, nextLine, diffStyle) : nextLine
276+
276277
// 忽略匹配的行等价于相等
277-
const leftDiffType = ignoreRegex?.test(leftLine) ? DiffType.EQUAL : DiffType.DELETE
278-
const rightDiffType = ignoreRegex?.test(rightLine) ? DiffType.EQUAL : DiffType.ADD
278+
const leftDiffType = ignoreRegex?.test(curLine) ? DiffType.EQUAL : DiffType.DELETE
279+
const rightDiffType = ignoreRegex?.test(nextLine) ? DiffType.EQUAL : DiffType.ADD
279280

280281
const left
281282
= j < cur.count!

0 commit comments

Comments
 (0)