Skip to content

Conversation

@Perlence
Copy link
Contributor

This PR fixes the issue with stripping surrounding whitespace in wrapped lines and aligns the wrapping behavior with modern text editors, while making the algorithm simpler.

The issue is that when the user hits Space at the start of a wrapped line, nothing seems to happen. But actually, the spaces are inserted under the hood. This behavior is confusing.

Here's the video showing the issue (audio):

Screen.Recording.2026-01-23.at.20.05.40.mp4

And here's a screenshot of a few text editors soft-wrapping the text at different points. Here, I chose to follow VS Code, Zed, and Edit and use their wrapping logic. I've included these examples in the tests.

image

@badlogic
Copy link
Owner

Wow, thank you for putting in the effort with the video explainer, much appreciated! I got annoyed by this today as well and wanted to fix it up, but now I don't have to spend time on this anymore. Thank you!

@badlogic badlogic merged commit cd8ce45 into badlogic:main Jan 24, 2026
2 checks passed
@Perlence Perlence deleted the fix/wrap-whitespace branch January 24, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants