Skip to content

Writing comments has weird behaviour with leading and trailing spaces #1602

Open

Description

@stefvanschie

Observed/problematic behavior

When deleting a version you can write a comment with a reason for why the version is being deleted. This text area has some weird behaviour with regards to leading and trailing spaces that makes typing a comment very difficult. Here are some examples of problematic behaviour (note the spaces in the examples):

Type "abc d". When you now have the cursor at the end and press backspace, both the 'd' and the space before it are removed. This is one I encounter relatively often when fixing typos and usually means I end up with another mistake as the two words that would be separated by a space are now joined together.

Type "abc def ". Put the cursor after the first space and press backspace. The space is deleted, but also the trailing space is gone. The cursor is also moved to the very end of the text area, instead of remaining in between the text.

Type " abcdef". Put the cursor in between "abc" and "def" and press the spacebar. The space is inserted, the leading space is gone and the cursor is moved towards the end, instead of remaining in between.

Entering a space or deleting a character seems to trigger some kind of trimming operation which can often put the cursor in a different position, which is unexpected and messes up your writing.

Expected behavior

I think the easiest solution is to just trim the text when you actually press the delete button, instead of when you are typing. User's might be unaware of this trimming operation, but this is a pretty harmless operation, so I don't think it really matters that a user might be unaware of it. Otherwise, some other solution is also fine, as long as typing isn't interrupted. (E.g., a preview area with the trimmed text.)

Steps to reproduce

Go to a version and click on the delete button. Then type any of the given examples in the comment box and press the indicated buttons.

Other

Reproduced on http://hangar.papermc.io.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions