# Support "dtx" vim key combination when "x" is immediately to the right of the cursor \(\#6830\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 331b6e7e6ed5e600257d235f49d4d6f12a4e550e

Requested commit: 331b6e7e6ed5e600257d235f49d4d6f12a4e550e

Commit: 331b6e7e6ed5e600257d235f49d4d6f12a4e550e

Tree: 581c0570eef0a6f168b27021711bc2c758b09295

Author: Conrad Irwin

Committer: GitHub

## Message

```
Support "dtx" vim key combination when "x" is immediately to the right of the cursor (#6830)

Closes #4358

The bug originates on this line:
https://github.com/zed-industries/zed/blob/5db7e8f89ee4f5d9801a2eab88adc1db3fda0f46/crates/vim/src/motion.rs#L451

- When running "dtx" on "ˇabcx", the range to delete is 0 -> 2 ("abc")
- When running "dtx" on "abˇcx", the range to delete is 2 -> 2 ("c"), so
`new_point == point` and the function incorrectly returns `None` and "c"
is not deleted
- We need to disambiguate between the "not found" case and the "found
immediately to the right" case
- This bug does not apply to the backwards case ("dTx")

Release Notes:
- Fixed "dtx" vim key combination when "x" is immediately to the right
of the cursor (#4358)
```

## Parents

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

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

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