agent_ui: Don't reset cursor position when editing queued messages (#52210)

## Context

When typing on the read-only queued message editor, we push the content
to the main, editable message editor. However, the cursor position was
being reset when that happened. This PR fixes that by tracking the
cursor offset when doing that, also accounting for the case where there
could be pre-existing content in the message editor.

## How to Review

- Queue a message in the agent panel
- Place your cursor somewhere in the middle of your queued message and
type something
- See how the cursor position is preserved once it goes down to the main
message editor

## Self-Review Checklist

<!-- Check before requesting review: -->
- [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

Release Notes:

- Agent: Fix cursor position being reset when editing queued messages.
3225e53f2fDanilo Leal committed on 3/23/2026, 11:12:44 PM· committed by GitHubparentae6a9c5
3 files changedLine totals unavailable