← 返回首页
Feature Request - To Merge Differences · Issue #168 · java-diff-utils/java-diff-utils · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

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

Provide feedback

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

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Feature Request - To Merge Differences #168

New issue
New issue

Description

Describe the Feature
A new request to consider including whitespace (space in my case) to represent the differences.

To Reproduce
Steps to reproduce the behavior:

  1. Example data --> Included in snippet.
  2. simple program snippet
import java.util.Arrays; import java.util.List; import com.github.difflib.text.DiffRow; import com.github.difflib.text.DiffRowGenerator; public class ShowDiffViewUsingJavaDiffUtils { static String leftString = "A sample string to test this tool."; static String rightString = "A sample string is defined here and will be used to test diff library."; public static void main(String[] args) throws Throwable { //create a configured DiffRowGenerator DiffRowGenerator generator = DiffRowGenerator.create() .ignoreWhiteSpaces(true) .showInlineDiffs(true) .mergeOriginalRevised(false) .inlineDiffByWord(true) .oldTag(f -> "--") .newTag(f -> "++") .build(); //compute the differences for two test texts. List<DiffRow> rows = generator.generateDiffRows( Arrays.asList(leftString), Arrays.asList(rightString)); rows.stream().forEach(r -> { System.out.println("OldLine: " + r.getOldLine()); System.out.println("NewLine: " + r.getNewLine()); }); } }
  1. See error - NA.

Expected behavior
The output of my program is:

OldLine: A sample string to test --this-- --tool--. NewLine: A sample string ++is defined here and will be used ++to test ++diff++ ++library++.

I would like to have this diff tool to consider whitespace. e.g. consider whitespace between this tool for the differences.
Expected output:

OldLine: A sample string to test --this tool--. NewLine: A sample string ++is defined here and will be used ++to test ++diff library++.

I have tried all possible configurations to achieve this, but no luck, hence raising this request. If the feature does exist, please share the details.

System

  • Java version - 1.8
  • Version - 4.12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    • Open in GitHub Copilot app

    Footer

    © 2026 GitHub, Inc.