Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character based comparison #7

Closed
goroggy opened this issue Oct 15, 2020 · 9 comments
Closed

Character based comparison #7

goroggy opened this issue Oct 15, 2020 · 9 comments

Comments

@goroggy
Copy link

goroggy commented Oct 15, 2020

Hi, his is a wonder control.
However, I need character differences, how to do that?
Thanks.

@VPKSoft
Copy link
Collaborator

VPKSoft commented Oct 16, 2020

Hi, this seems to be matching word boundaries (the DiffPlex library) by default:
image
I assume you mean the side-by-side model which is created by the SideBySideDiffBuilder class.

I'll have to look into character diff once I have the time, maybe in the coming weekend...

@goroggy
Copy link
Author

goroggy commented Oct 16, 2020

Thanks, that would be fine. Yes, I mean the sideBySide model.

@goroggy
Copy link
Author

goroggy commented Oct 16, 2020

Diff has CreateCharacterDiffs but SideBySideDiffBuilder seems not to invoke it (you cannot pass a characterChunker).
I modified SideBySideDiffBuilder so that it takes CharacterChunker.Instance in place of WordChunker.Instance and it works:
image

However I don't want to mess the code so please it would be nice if you could implement it.

Btw the Difflpex PR 50 code examples say SideBySideBuilder instead of SideBySideDiffBuilder.

@VPKSoft
Copy link
Collaborator

VPKSoft commented Oct 18, 2020

Hi, The NuGet for the character based diff/comparison is now added to the package, please let me know if there are any bugs 🤔
New properties:
image
With the CharacterComparison property set:
image
With both the CharacterComparison and the CharacterComparisonMarkAddRemove properties set:
image

TODO::Different project for the unofficial.ScintillaNET package.

@goroggy
Copy link
Author

goroggy commented Oct 19, 2020

Thanks, Petteri, this is what I call fast service. Will be back with experience.

@goroggy
Copy link
Author

goroggy commented Oct 19, 2020

Sorry, I have this error when the number of lines are not the same (and in my case it happens often)
Specified argument was out of the range of valid values.
Parameter name: startIndex
at System.String.Insert(Int32 startIndex, String value)
at ScintillaDiff.ScintillaDiffControl.SpanLeftRightChars(DiffResult diffResult, Int32 line, String oldLine, String newLine, List`1& charChangedList)
at ScintillaDiff.ScintillaDiffControl.DiffTextsSideBySide()
at ScintillaDiff.ScintillaDiffControl.set_TextRight(String value)

@VPKSoft
Copy link
Collaborator

VPKSoft commented Oct 19, 2020

Alright, need to look for a fix for that... perhaps too little test material was used 🙄

@VPKSoft
Copy link
Collaborator

VPKSoft commented Oct 25, 2020

Hi, the issue should be fixed now. Removing one +1 should do the job 😅

Fixed string.Insert error in case the CharacterComparisonMarkAddRemove property was set to true and a zero-length line occurred within the text.

@goroggy
Copy link
Author

goroggy commented Oct 28, 2020

Thanks, the error disappeared. I think I will let the user choose between word based and character based comparisons. When the lines themselves do not much, character-based looks rather weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants