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

Display.withCrLf() is producing wrong line breaks on Windows #1557

Open
Christopher-Hermann opened this issue Oct 25, 2024 · 1 comment
Open
Labels
good first issue Good for newcomers

Comments

@Christopher-Hermann
Copy link
Contributor

Christopher-Hermann commented Oct 25, 2024

Describe the bug
Display.withCrLf() is producing wrong line breaks based on the heuristics in the Windows implementation. This happens only for Strings that contains broken formatting itself. But nevertheless, I think we can fix this issue by improving the method implementation.

To Reproduce
See Test case

	@Test
	public void testMixedLfAndCrflOnWindows() {
		if (!SWT.getPlatform().equals("win32")) {
			return;
		}

		String act = Display.withCrLf("First Line \n second line \r\n third line");

		assertEquals("First Line \r\n second line \r\n third line", act);
	}

Expected behavior
Expectation is that the method replaces all standalone \n with \r\n.
With the given example, \r\n results in \r\r\n

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
@Christopher-Hermann Christopher-Hermann added the good first issue Good for newcomers label Oct 25, 2024
@scvirl
Copy link

scvirl commented Oct 26, 2024

@Christopher-Hermann
Hi,
Could you please assign this issue to me, I would love to fix it.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants