Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 421
Brett Avatar asked Apr 10 '12 16:04

Brett


3 Answers

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.

like image 158
Alain Avatar answered Dec 15 '22 00:12

Alain


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/

like image 30
sixtyfootersdude Avatar answered Dec 14 '22 23:12

sixtyfootersdude


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

like image 34
bhlowe Avatar answered Dec 15 '22 00:12

bhlowe