# Fix title/camelCase commands stripping leading indentation Fixes \(\#50523\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7a615628457d8ce5dc9a4cd682682726fc9589cd

Requested commit: 7a615628457d8ce5dc9a4cd682682726fc9589cd

Commit: 7a615628457d8ce5dc9a4cd682682726fc9589cd

Tree: 30af9ffcf0ca14dd9e776ddd7af959d145d4e67f

Author: Om Chillure

Committer: GitHub

## Message

```
Fix title/camelCase commands stripping leading indentation  Fixes (#50523)

Fixes: #48945

Description:

The convert:to-title-case, convert:to-upper-camel-case, and
convert:to-lower-camel-case editor commands were stripping leading
whitespace from each line of a multi-line selection.

Root cause: The conversion functions split on whitespace using
.split_whitespace() and then joined the resulting words, discarding any
leading spaces/tabs before the first word on each line.

Fix: Each line now preserves its leading whitespace by capturing and
re-prepending it before applying the case conversion.

Tests: Added test cases covering multi-line selections with indentation
for all three commands.

Video : 


[bug1fix.webm](https://github.com/user-attachments/assets/f4d25c55-bc6d-44e6-a989-7d9b4bc59ac9)

Release Notes:

- Fixed trailing whitespace handling on text case changes
```

## Parents

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

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