Comments (3)
It does support that. Let me show you some sample code. The below code will take the example you gave and print out two lines, the old and the new while highlighting any changes. I replace spaces with dots to make it easier to see.
Here is the code:
private static void Main()
{
var diffBuilder = new SideBySideDiffBuilder(new Differ());
var diff = diffBuilder.BuildDiffModel("This is text 1", "This is text 1", ignoreWhitespace: false);
PrintDiffSide(diff.OldText);
PrintDiffSide(diff.NewText);
}
private static void PrintDiffSide(DiffPaneModel diff)
{
foreach (var line in diff.Lines)
{
foreach (var part in line.SubPieces)
{
var partWithSpacesMadeVisible = part.Text.Replace(" ", "ยท");
switch (part.Type)
{
case ChangeType.Inserted:
Console.ForegroundColor = ConsoleColor.Green;
break;
case ChangeType.Deleted:
Console.ForegroundColor = ConsoleColor.Red;
break;
case ChangeType.Unchanged:
Console.ForegroundColor = ConsoleColor.White;
break;
}
Console.Write(partWithSpacesMadeVisible);
}
}
Console.WriteLine();
}
@lchthanhth615 let me know if you have any questions on this
from diffplex.
Thanks @mmanela for your response.
Not sure why, but I install the plugin from .NET Nugget Manager (DiffPlex.Wpf.1.3.1 and DiffPlex.1.7.1) and using Diff-viewer on WinForm. And I see it cannot show diff for that case:
It will work if we replace space to Dot like your example, but it's not make sense in my case.
Could you please help to check ?
from diffplex.
Most likely the WPF control is not exposing the setting to consider white space
from diffplex.
Related Issues (20)
- .NET 5 support HOT 2
- Add option to ignore trailing commas HOT 1
- Stream support HOT 1
- Can you copy the left and right rows and get the changed content at the same time? HOT 2
- Next / Previous commands for WPF controls? HOT 9
- ChangeType.Modified is not working, instead it shows the changed line as deleted and added HOT 1
- Unexpected line diffs when a code block is inserted after a previous difference
- Customise skipping of lines HOT 2
- spurious blank lines at end HOT 2
- Any chance of having a search feature in the future?
- Wrap lines in WPF control? HOT 5
- Could Diffplex avoid exporting the Log class? HOT 1
- Does DiffPlex supports Blazor webassembly. NET 7? HOT 1
- Span usage HOT 1
- GetLinesInViewport has issues with collapse unchanged sections HOT 1
- GetLinesInViewport has issues with ignore unchanged.
- Is UnidiffFormatter.cs no longer included? HOT 1
- Loading of Large File Hangs HOT 5
- No text showing in windows forms HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diffplex.