Skip to content

Consecutive spaces and line break algorithm can cause trailing whitespace #1921

Open
@dalewking

Description

Describe the bug
Stumbled upon this. Was adding some KDoc comments based on some text from elsewhere. That text had 2 spaces after a period and that happened to be where the line breaking algorithm broke the text but it resulted in a trailing whitespace on the line. This can be annoying because the IDE likes to remove them and in our case the generated code will be checked into git causing diffs

To Reproduce
Adding this line to a top level function spec will show it:

       addKdoc("@param xxxxxxxxxXXXXXXX Blah blah blah blah blah blah blah blah blah blah blah blah blah blah.  Blah\n")

Note that there are 2 spaces after the period.

The output will be:

/**
 * @param xxxxxxxxxXXXXXXX Blah blah blah blah blah blah blah blah blah blah blah blah blah blah. 
 * Blah
 */

which has a space at the end of the first line

Expected behavior
I expect the generated code to have no trailing whitespace

Additional context
My workaround is to collapse multiple spaces to 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions