# editor: Use visible cursor position for rename \(\#55542\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b30ef390e13f141f8f2c5135c721c7248ef44bd5

Requested commit: b30ef390e13f141f8f2c5135c721c7248ef44bd5

Commit: b30ef390e13f141f8f2c5135c721c7248ef44bd5

Tree: 8cee23047c828033fff2b501ed81ab9375f8ef02

Author: sunwukk990

Committer: GitHub

## Message

```
editor: Use visible cursor position for rename (#55542)

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #54160

Summary:

In Helix mode, rename could fail when the cursor was visually positioned
on the last character of a symbol. The editor renders some Vim/Helix
selections with the visible cursor offset from the selection head, but
rename was still using the raw selection head as the LSP prepare-rename
position.

This updates rename to use the visible cursor position for point lookup
when cursor offset rendering is active. It also adds regression coverage
for Helix rename and Vim visual rename.

Verification:

- `cargo check -p editor`
- `cargo fmt --check --package editor --package vim`
- `git diff --check -- crates\editor\src\editor.rs
crates\vim\src\test.rs`
- `test::test_rename`
- `test::test_helix_rename_uses_visible_cursor_position`
- `test::test_visual_rename_uses_visible_cursor_position`

Release Notes:

- Fixed Helix mode rename when the cursor is visually on the last
character of a symbol.

---------

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

## Parents

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

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