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

Visualize CR and LF symbols #2

Closed
vlsi opened this issue Nov 12, 2019 · 1 comment
Closed

Visualize CR and LF symbols #2

vlsi opened this issue Nov 12, 2019 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@vlsi
Copy link
Member

vlsi commented Nov 12, 2019

CR and LF are invisible in Spotless output.

For instance:

      src/core/src/main/java/org/apache/jmeter/SplashScreen.java
          @@ -52,7 +52,7 @@
                   setLocationRelativeTo(null);\n
               }\n
           \n
          -    private int x=2;\r\n
          +    private int x=2;\n
           \n
               /**\n
                * Show screen\n

So far so good. Spotless shows that \n should not be there (which is true because I'm on macOS, and lines should end with LF).

However, if I add one more line with "trailing whitespace", then the output becomes

      src/core/src/main/java/org/apache/jmeter/SplashScreen.java
          @@ -53,7 +53,7 @@
           ····}

           ·····private·int·x=2;
          -·····private·int·y=3;··
          +·····private·int·y=3;

           ····/**
           ·····*·Show·screen

Note: x=2 still has the wrong line ending, however, spotless does not print a warning on that.

spotlessApply corrects both issues (newline and the trailing whitespace).

Have you considered to use unicode characters like
SYMBOL FOR CARRIAGE RETURN, ␍
SYMBOL FOR LINE FEED, ␊
?

Then the output could be like

      src/core/src/main/java/org/apache/jmeter/SplashScreen.java
          @@ -53,7 +53,7 @@
           ····}

          -·····private·int·x=2;␍␊
          -·····private·int·y=3;··␊
          -·····private·int·x=2;␊
          +·····private·int·y=3;␊

           ····/**
           ·····*·Show·screen
@vlsi
Copy link
Member Author

vlsi commented Dec 26, 2019

Fixed in 08163be

@vlsi vlsi closed this as completed Dec 26, 2019
@vlsi vlsi added the enhancement New feature or request label Dec 26, 2019
@vlsi vlsi added this to the 3.0 milestone Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant