-
Notifications
You must be signed in to change notification settings - Fork 137
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
Display.withCrLf() is producing wrong line breaks on Windows #1557 #1562
base: master
Are you sure you want to change the base?
Conversation
…platform#1557 Changes functions so line breaks display correctly in Windows. Fixes eclipse-platform#1557
can you please add the test-case provided in #1557
|
Test Results 482 files - 1 482 suites - 1 8m 18s ⏱️ - 1m 37s For more details on these failures and errors, see this check. Results for commit a2045d4. ± Comparison against base commit 435fe7e. This pull request removes 35 tests.
|
There are failing test that are related to this change. Looks like some edge cases which results in out of bounds exception |
} | ||
} | ||
return result.toString (); | ||
return result.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not took a detailed look in the original coding, but according to ChatGTP, we could just use a regex to normalize the String. See the coding:
/**
* Normalize line breaks in a string to Windows line breaks (\r\n)
*
* @param input The input string
* @return The string with normalized line breaks
*/
public static String normalizeLineBreaks(String input) {
// Replace \r\n, \r, or \n with \r\n
return input.replaceAll("(\r\n|\r|\n)", "\r\n");
}
This seems pretty easy and clean. Maybe you can give it a try.
Fixes issue #1557
Changes functions so line breaks display correctly in Windows.
Fixes #1557