Make soft-wrap break words before a slash or space and after a dash #17949
Conversation
Hi, it’s been almost a months. Thoughts about this PR? |
@rsese done! |
Oh sorry my comment wasn't clear, I meant to copy over #17141 (comment) here in this pull request along with mentioning the adjustments you made? |
@rsese I updated my comment, is that it? |
Yes, thank you Oh also, about this comment:
You mean the CI failure yes? |
@rsese yes |
475ace5
to
81364b6
I rebased my code, partly to trigger the CI and be sure my change didn’t break anything. |
Seems that CI failed this time due to a known test flake on Windows, I'm restarting it again. |
Sorry for the delay! We've been having some flaky CI issues lately so I re-ran this again and everything is green now. Merging this, thanks a lot @ariasuni! |
Description of the Change
Wrapping now includes wrap on dash and slash. Remake of #17141, which was in response to issue #16904, in which the user wanted more "aggressive" wrapping. To implement this change, the isWrapBoundary variable was given character checks for spaces, slashes, and dashes as wrap boundaries.
Compared to the previous iteration of this PR, it checks if the previousCharacter (not the current character) is a dash, to cut words after it, so that it is consistent with how word-wrapping works in most software.
Any help to fix tests is appreciated since I do not have experience with those.
Alternate Designs
The proposed version was selected because it produced the simplest fix to this problem.
Why Should This Be In Core?
This should be in the core because it has to do with editor functionality.
Benefits
A much more intuitive soft-wrap functionality that doesn't breakup words in the middle if it doesn't have to.
Possible Drawbacks
This is not a new behavior, but it will be more visible:
The cursor can’t be after the last character, because it’s the same position than the beginning of the following line, and so “Move to end of line” puts the cursor before the last character of the line visually.
Verification Process
The new soft-wrap was tested with tests such as these:
