Skip to content

Add an option to return one change object per token (e.g. a single line per change object when comparing lines) #148

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

Closed
hubgit opened this issue Nov 1, 2016 · 4 comments · Fixed by #460

Comments

@hubgit
Copy link

hubgit commented Nov 1, 2016

When using diffLines to compare two versions of a text, would it be possible for each change object to only contain a single line, rather than merging consecutive lines into a single change object?

@Ohar
Copy link

Ohar commented Dec 13, 2016

@hubgit Can it helps you?

newlineIsToken: true to treat newline characters as separate tokens. This allows for changes to the newline structure to occur independently of the line content and to be treated as such. In general this is the more human friendly form of diffLines and diffLines is better suited for patches and other computer friendly output.

@leviwheatcroft
Copy link

I don't know what 'newlineIsToken' actually does, but it doesn't seem to split changes into lines.

@ExplodingCabbage
Copy link
Collaborator

No reason for this to be specific to diffLines; it would just as well make sense to have one change object per word in diffWords, or one change object per character in diffChars. And yeah, adding an option for that makes sense to me!

@ExplodingCabbage ExplodingCabbage changed the title Return a single line per change when comparing lines Add an option to return one change object per token (e.g. a single line per change object when comparing lines) Dec 20, 2023
This was referenced Jan 2, 2024
@ExplodingCabbage
Copy link
Collaborator

Fix ready to go out in the release after next. (Had to implement this on top of some breaking changes to make it not be a nightmare, which is why it won't be in the next release.)

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

Successfully merging a pull request may close this issue.

4 participants