# ep: Fix cursor marker leak due to edit splitting in V4 API \(\#60110\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 29faf94a0fd86029d515c4265c8a223661811379

Requested commit: 29faf94a0fd86029d515c4265c8a223661811379

Commit: 29faf94a0fd86029d515c4265c8a223661811379

Tree: 853c9fe7cbf62e86bd705a75f1115e6e37675c64

Author: Ben Kunkle

Committer: GitHub

## Message

```
ep: Fix cursor marker leak due to edit splitting in V4 API (#60110)

# Objective

Closes EP-202

Prevent V4 edit predictions from leaking `<|user_cursor|>` markers into
users' buffers.

## Solution

- Strip cursor marker text from emitted prediction edits, including when
`text_diff` splits the marker across edit fragments.
- Preserve literal marker-like text that already exists in the buffer.

## Testing

- `cargo test -p edit_prediction prediction_edits_for_single_file_diff
-- --nocapture`
- `cargo test -p edit_prediction --lib`
- `cargo fmt --check`

## 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 adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- N/A
```

## Parents

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

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