# editor: Fix auto indent adding trailing whitespace on repeated enter \(\#52628\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/e5086f306e730d01f6a5fffab16476e6057f56de)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: e5086f306e730d01f6a5fffab16476e6057f56de

Requested commit: e5086f306e730d01f6a5fffab16476e6057f56de

Commit: e5086f306e730d01f6a5fffab16476e6057f56de

Tree: 2b4fdec664c9db26d97d7a03803e9e6847fbc181

Author: Gonçalo Aleixo

Committer: GitHub

## Message

```
editor: Fix auto indent adding trailing whitespace on repeated enter (#52628)

Update how auto indentation is handled by `Editor::newline`, in the case
where auto-indentation is not `AutoIndentationMode::None`, so as to
extend the range of the edits being applied to the beginning of the
line, in case the line only contains the indentation whitespace or
there's only whitespace indentation before the cursor position

This ensures that newlines are not left with whitespace.

Closes #34316 

Release Notes:

- Fixed auto indent leaving trailing whitespace on blank indented lines
when creating new lines.⁠

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
```

## Parents

- [0ba60d8a4460206708dce42db9539e2900251cf7](https://git.cafe/gitcafe/zed/commit/0ba60d8a4460206708dce42db9539e2900251cf7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/e5086f306e730d01f6a5fffab16476e6057f56de?format=markdown)
