Bug 74636 - [Viewers] Ignore whites spaces and CR/LF option
Summary: [Viewers] Ignore whites spaces and CR/LF option
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement with 10 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Compare-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 45857 (view as bug list)
Depends on:
Blocks: 203430
  Show dependency tree
 
Reported: 2004-09-22 13:47 EDT by Alexander Burdukov CLA
Modified: 2013-08-23 07:50 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Burdukov CLA 2004-09-22 13:47:06 EDT
"Ignore white spaces" options should work in two ways:
1. Ignore white spaces only
2. Ignore All (whitespaces + CR/LF)
This is very useful feature, which is abstent in Eclipse, but exists in 
IntelliJ IDEA 4
Comment 1 Channing Walton CLA 2004-09-23 04:04:53 EDT
This would be very useful for me too.
Comment 2 Marko Schulz CLA 2005-03-22 11:02:45 EST
What for would be an "Ignore white spaces only"? I expect "Ignore white space"
to always ignore spaces and tabs as well as line feeds and carriage returns. It
is a pain that eclipse's compare is not able to ignore the latter.
Comment 3 Philip Borlin CLA 2005-03-22 12:18:36 EST
Bug #45857 (which I think is getting closed in favor of this bug) under my
comment describes a use case that describes why ignore white spaces is broken. 
The big problem (according to Marko Schulz in Bug #45857) is that Eclipse's
compare is line based.

Another use case around here occurs when there is a piece of legacy code that is
not formatted to the team coding standards.  Simultaneously you and a fellow
developer edit the same piece of code.  He runs the formatter but you don't and
suddenly Eclipse reports conflicts on almost every line of the class when you go
to synchronize with your repository.  Very annoying.
Comment 4 Martin Aeschlimann CLA 2007-10-23 09:12:57 EDT
*** Bug 45857 has been marked as a duplicate of this bug. ***
Comment 5 Aaron Digulla CLA 2010-07-02 09:16:35 EDT
If you compare a file where the only difference is CR+LF vs. LF, then you get a change in every line but the change itself isn't visible. In this case, it would be great if the compare view would show some strange character like "CR" at the end of the line to make it obvious where the change is.

Also, all compare views should have toggle buttons to switch various ignore options (ignore whitespace, ignore CRLF, ignore empty lines, ignore whitespace before text, ignore whitespace after text).
Comment 6 Tomasz Zarna CLA 2010-07-06 05:04:23 EDT
(In reply to comment #5)
> (...) it would be great if the compare view would show some strange character like "CR" at the
> end of the line to make it obvious where the change is.

IMO we could highlight whitespace chars (when shown) that differ the same way we highlight individual changes (when the option is on).
Comment 7 Aaron Digulla CLA 2010-07-07 04:10:14 EDT
(In reply to comment #6)

> IMO we could highlight whitespace chars (when shown) that differ the same way
> we highlight individual changes (when the option is on).

That would work but please add buttons to toggle these options in the view! It's very annoying to have to close the dialog, open the preferences or switch to a perspective where the toggle button is available.
Comment 8 Tomasz Zarna CLA 2010-07-14 05:09:55 EDT
Are you referring to the proposed "Highlight whitespace chars diff" toggle? This should be a pref imo. "Ignore white space" and "Show Whitespace Characters" actions are both available in context menu.
Comment 9 Aaron Digulla CLA 2010-07-14 11:39:26 EDT
After several years with Eclipse, I completely missed the context menu in the diff viewer =8*O My apologies.

As to my original request, I see this on the screen:

о                            о
<tr class="error even">о     <tr class="error even">о
<td class="Date">...</td>о   <td class="Date">...</td>о

The diff is that the "о" after 'even">' on the left side is made of "CR+LF" while in the right view, it's just "LF". The dialog (which get from assertEquals() in a test case) doesn't show *any* difference but the test failed.

This is very anoying. Can you show the little left arrow or maybe "оо" to make this visible?

Test case:

assertEquals("a\r\nb", "a\nb");
Comment 10 Tomasz Zarna CLA 2010-07-19 08:01:46 EDT
After debugging I realized that the case with Compare Results dialog is a little bit different. The problem here is not with the merge viewer displaying the difference in a wrong way, but with content of the left and the right side. They are equal[1] and both are: "a\nb"! This is caused by AppendingProcessingState[2] class with produces "actual" and "expected" strings to be displayed in the dialog.

This particular case looks more like a JDT/JUnit bug, so you should open a bug against them. Of course, the original request on this bug is still valid.

[1] org.eclipse.jdt.internal.junit.ui.CompareResultDialog.setFailedTest(TestElement)
[2] org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient.AppendingProcessingState.readMessage(String)