Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite37a523

Browse files
committed
fixes#66
1 parentfb7fca6 commite37a523

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

‎java-diff-utils/src/main/java/com/github/difflib/text/DiffRowGenerator.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ private List<DiffRow> generateInlineDiffs(AbstractDelta<String> delta) throws Di
291291
origList =inlineDiffSplitter.apply(joinedOrig);
292292
revList =inlineDiffSplitter.apply(joinedRev);
293293

294-
List<AbstractDelta<String>>inlineDeltas =DiffUtils.diff(origList,revList).getDeltas();
294+
List<AbstractDelta<String>>inlineDeltas =DiffUtils.diff(origList,revList,equalizer).getDeltas();
295295

296296
Collections.reverse(inlineDeltas);
297297
for (AbstractDelta<String>inlineDelta :inlineDeltas) {

‎java-diff-utils/src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,44 @@ public void testGenerationIssue44reportLinesUnchangedProblem() throws DiffExcept
417417
List<DiffRow>rows =generator.generateDiffRows(Arrays.asList("<dt>To do</dt>"),Arrays.asList("<dt>Done</dt>"));
418418
assertEquals("[[CHANGE,<dt>~~T~~o~~ do~~</dt>,<dt>**D**o**ne**</dt>]]",rows.toString());
419419
}
420+
421+
@Test
422+
publicvoidtestIgnoreWhitespaceIssue66()throwsDiffException {
423+
DiffRowGeneratorgenerator =DiffRowGenerator.create()
424+
.showInlineDiffs(true)
425+
.inlineDiffByWord(true)
426+
.ignoreWhiteSpaces(true)
427+
.mergeOriginalRevised(true)
428+
.oldTag(f ->"~")//introduce markdown style for strikethrough
429+
.newTag(f ->"**")//introduce markdown style for bold
430+
.build();
431+
432+
//compute the differences for two test texts.
433+
//CHECKSTYLE:OFF
434+
List<DiffRow>rows =generator.generateDiffRows(
435+
Arrays.asList("This\tis\ta\ttest."),
436+
Arrays.asList("This is a test"));
437+
//CHECKSTYLE:ON
438+
439+
assertEquals("This is a test~.~",rows.get(0).getOldLine());
440+
}
441+
442+
@Test
443+
publicvoidtestIgnoreWhitespaceIssue66_2()throwsDiffException {
444+
DiffRowGeneratorgenerator =DiffRowGenerator.create()
445+
.showInlineDiffs(true)
446+
.inlineDiffByWord(true)
447+
.ignoreWhiteSpaces(true)
448+
.mergeOriginalRevised(true)
449+
.oldTag(f ->"~")//introduce markdown style for strikethrough
450+
.newTag(f ->"**")//introduce markdown style for bold
451+
.build();
452+
453+
//compute the differences for two test texts.
454+
List<DiffRow>rows =generator.generateDiffRows(
455+
Arrays.asList("This is a test."),
456+
Arrays.asList("This is a test"));
457+
458+
assertEquals("This is a test~.~",rows.get(0).getOldLine());
459+
}
420460
}

‎pom.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
<modulename="SuppressWarningsFilter" />
142142
<modulename="FileTabCharacter" />
143143
<modulename="TreeWalker">
144+
<modulename="SuppressionCommentFilter"/>
144145
<modulename="AvoidNestedBlocks" />
145146
<modulename="ConstantName" />
146147
<modulename="EmptyCatchBlock" />

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp