Brett
Brett

Reputation: 20049

How to ignore line breaks?

I have it ignoring unimportant differences, but I want the below to not show as a difference..

3.  TITLE

blah blah blah blah blah blah blah blah blah blah

3.  TITLE
blah blah blah
blah blah blah
blah blah blah blah

Upvotes: 12

Views: 6225

Answers (3)

bhlowe
bhlowe

Reputation: 468

I found Compare++ can compare code, ignoring linefeeds, whitespace and comment differences. http://cmpp.coodesoft.com/main/downloads

Upvotes: 1

sixtyfootersdude
sixtyfootersdude

Reputation: 27221

I was also hoping that beyond compare would have something like this built in. Looks like it doesn't.

The best solution I have found to do this is to use some kind of code formatter on both sides. This allows you to compare real changes in the code. For javascript, I use JSBeautify.

For Java you could probably use your editor's built in beautifier or something like this: http://prettyprinter.de/

Upvotes: 1

Alain
Alain

Reputation: 27220

That's probably not possible. I just screwed around with grammar rules for about 30 minutes and even if you're ignoring line breaks, it won't treat the non-ignored text on separate lines as being continuous across line breaks.

Effectively what you are asking the comparer to do is strip all line breaks out of the documents and compare the two documents as though each were just a single (long) line of text. You could do this manually for purposes of detecting changes, but you wouldn't be able to merge changes in this way.

Upvotes: 7

Related Questions