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

Feature Request - To Merge Differences #168

Closed
@gvjoshi25

Description

@gvjoshi25

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 betweenthis 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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp