# Expand empty selections to cover full word when doing case conversions and fix bugs \(\#2826\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7777d973cdece0420fd1c3c15336b3a5e7b148a2

Requested commit: 7777d973cdece0420fd1c3c15336b3a5e7b148a2

Commit: 7777d973cdece0420fd1c3c15336b3a5e7b148a2

Tree: 41be5d2d72cb70c9e392cdfa5389be01e9b3d1af

Author: Joseph T\. Lyons

Committer: GitHub

## Message

```
Expand empty selections to cover full word when doing case conversions and fix bugs (#2826)

When doing case conversions, specifically in the case of an empty
selection, in both VS Code and Sublime, the cursor winds up being in a
different place relative to where it started.

In VS Code, the cursor maintains it position in the text, no matter if
the text expands or shrinks


https://github.com/zed-industries/zed/assets/19867440/b24f5d86-c315-4a72-9ed4-3732b490ea9a

In Sublime, I have no idea what is going on:


https://github.com/zed-industries/zed/assets/19867440/05f21303-6e42-47b2-b844-7accd0bf05d7

I thought it would be a better experience if, when doing an empty
selection transformation, we simply expand the selection and park the
cursor at the end of the newly-transformed text.


https://github.com/zed-industries/zed/assets/19867440/833619ef-04e2-47b6-ad4e-e2b43d54fb2b

This feels similar to us expanding the selection when doing line
manipulations:


https://github.com/zed-industries/zed/assets/19867440/c30c5332-787d-4cf0-a9ee-e66c3c159956

Selections are adjusted to match however each word expands and shrinks,
even when there are multiple:


https://github.com/zed-industries/zed/assets/19867440/d7073aac-8a59-4f2c-b0e5-1df37be1694c

Release Notes:

- Improved behavior of empty-selection case transformations by selecting
resulting word.
- Fixed some bugs with overflow
```

## Parents

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

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

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