Skip to content

trim_trailing_whitespace moves caret #47

@theoy

Description

@theoy

( ported from Microsoft/vscode-editorconfig#24 )

Repro'd on editorconfig v0.2.7:

  1. Enable autosave in VS Code (e.g. in user settings) - great for users who are used to using Git to back up their code.
  2. Open up a workspace that lacks VS Code workspace settings for files.trimTrailingWhitespace.
  3. In the same workspace, create a .editorconfig, setting trim_trailing_whitespace = true

Type some code with spaces, then rest (wait for autosave delay).

Expected: Caret position remains, trailing whitespace preceding the caret is not trimmed
Actual: All trailing whitespace is trimmed, causing the caret to move and the code (whitespace) that was under composition to be deleted.

Note, this caused me to stop using trim_trailing_whitespace for a while, before I realised that enabling the matching VS Code option overrode the behaviour to be correct. However, figured it was worth reporting so that this could be improved for new users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions