Skip to content

Commit

Permalink
Update the rule of inlineDiffByWord
Browse files Browse the repository at this point in the history
Only if one word has space, show inlineDiffByWord.
  • Loading branch information
XJ114514 committed Oct 9, 2024
1 parent cc69bfb commit 705b4cf
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
class DiffPrinter {
//print the difference of two print to out
static void printDiff(PrintWriter out, String expected, String actual) {
DiffRowGenerator generator = DiffRowGenerator.create().showInlineDiffs(true).inlineDiffByWord(true).oldTag(
boolean inlineDiffByWordFlag = false;
if(expected.contains(" ") || actual.contains(" ")){
inlineDiffByWordFlag = true;
}
DiffRowGenerator generator = DiffRowGenerator.create().showInlineDiffs(true).inlineDiffByWord(inlineDiffByWordFlag).oldTag(
f -> "~~").newTag(f -> "**").build();
List<DiffRow> rows = generator.generateDiffRows(Arrays.asList(expected), Arrays.asList(actual));
out.println();
Expand Down

0 comments on commit 705b4cf

Please sign in to comment.