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

Incorrect EOL in diff #8211

Closed
hsalameh opened this issue Jun 11, 2020 · 7 comments · Fixed by #9620 or gitextensions/ICSharpCode.TextEditor#28
Closed

Incorrect EOL in diff #8211

hsalameh opened this issue Jun 11, 2020 · 7 comments · Fixed by #9620 or gitextensions/ICSharpCode.TextEditor#28
Assignees
Labels
🤓 good first issue type: bug 🐛 up-for-grabs Easy tasks for those looking to get involved. Refer to https://up-for-grabs.net/

Comments

@hsalameh
Copy link

Current behaviour

When you have a change in the end-of-line character from LF to CRLF, the diff doesn't show that.

Expected behaviour

The diff should show that the removed line had a LF while the added line has a CRLF

Steps to reproduce

Using a windows machine with the git config core.autocrlf set to false, do the following:

1)clone the repo https://github.com/hsalameh/gitext-nonprinting-bug.git
2) open the repo in Git Extensions
3) look at the diff of commit fbd611
4) turn on the "Show nonprinting characters" option
3) as shown in the attached screenshot, the diff should show a difference at the end of the indicated line, but they appear exactly the same. The EOL character should be shown differently in the - and + lines

Screenshots

image

Did this work in previous version of GitExtensions

I don't know

Environment

  • Git Extensions 3.3.1.7897
  • Build 5a97671
  • Git 2.24.1.windows.2
  • Microsoft Windows NT 10.0.18363.0
  • .NET Framework 4.8.4018.0
  • DPI 120dpi (125% scaling)

Diagnostics

@RussKie RussKie changed the title Wrong diff shown with the "Show nonprinting characters" option turned on Incorrect EOL in diff Jun 11, 2020
@RussKie RussKie added type: bug 🐛 🤓 good first issue up-for-grabs Easy tasks for those looking to get involved. Refer to https://up-for-grabs.net/ labels Jun 11, 2020
@gerhardol
Copy link
Member

This is how git-diff reports the difference between files

@mstv
Copy link
Member

mstv commented Jun 11, 2020

Opened in my favourite external difftool, line 2 not line 1 seems to have the changed EOL:

grafik
grafik

The git output is misleading, so also the display in GE:

grafik
Anyway, GE should not filter out ^M and try to display it.

(I have already criticised the alleged additional trailing new-line at the end of every diff in another issue.)

@gerhardol
Copy link
Member

Anyway, GE should not filter out ^M and try to display it.

But GE is not filtering, it displays what git-diff provides, from discussion in #7723

@hsalameh
Copy link
Author

hsalameh commented Jun 12, 2020

Opened in my favourite external difftool, line 2 not line 1 seems to have the changed EOL:

grafik

While git config core.autocrlf is set to false, if i clone and check out each of the commits and look at them in notepad++, i get this:

image

This leads me to believe that the first line is actually different while it's not reflected in the git extensions diff.

@hsalameh
Copy link
Author

Another one, using beyond compare

git difftool 49d822..fbd611

image

@mstv
Copy link
Member

mstv commented Jun 12, 2020

Yes, with core.autocrlf=false (it wasn't set before), I get the same diff.
grafik

The different EOLs are available in the property TextEditor.Text of the control.
Though unfortunately, ICSharpCode.TextEditor.TextView does not distinguish different EOL types.
The drawn character is hardcoded:

        private int DrawEOLMarker(Graphics g, Color color, Brush backBrush, int x, int y)
        {
            var eolMarkerColor = textArea.Document.HighlightingStrategy.GetColorFor("EOLMarkers");

            var width = GetWidth(ch: '\u00B6', eolMarkerColor.GetFont(TextEditorProperties.FontContainer));
            g.FillRectangle(
                backBrush,
                new RectangleF(x, y, width, FontHeight));

            DrawString(g, "\u00B6", eolMarkerColor.GetFont(TextEditorProperties.FontContainer), color, x, y);
            return width;
        }

lhiginbotham added a commit to lhiginbotham/gitextensions that referenced this issue Oct 6, 2021
	- update the ICSharpCode.TextEditor submodule to allow EOL differentiation
@lhiginbotham
Copy link
Contributor

@hsalameh @RussKie @gerhardol @mstv

I will put up a PR for this, please review when it is ready (some things will need design input from you guys, basically just what exactly should we show for the EOL markers). Thanks!

@ghost ghost added the 🚧 status: in progress Issues which have associated PRs label Oct 6, 2021
gerhardol added a commit to gerhardol/gitextensions that referenced this issue Oct 6, 2021
gerhardol added a commit to gerhardol/gitextensions that referenced this issue Oct 6, 2021
lhiginbotham added a commit to lhiginbotham/gitextensions that referenced this issue Oct 9, 2021
	- update the ICSharpCode.TextEditor submodule to allow EOL differentiation
lhiginbotham added a commit to lhiginbotham/gitextensions that referenced this issue Oct 10, 2021
	- update the ICSharpCode.TextEditor submodule to allow EOL differentiation
mstv pushed a commit that referenced this issue Oct 10, 2021
- update the ICSharpCode.TextEditor submodule to allow EOL differentiation
@ghost ghost removed the 🚧 status: in progress Issues which have associated PRs label Oct 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤓 good first issue type: bug 🐛 up-for-grabs Easy tasks for those looking to get involved. Refer to https://up-for-grabs.net/
Projects
None yet
5 participants