# agent_ui: Improve quote selections to consider message being edited \(\#39947\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 41ee92e5f2c9d58defb3cc3946940d492c39d756

Requested commit: 41ee92e5f2c9d58defb3cc3946940d492c39d756

Commit: 41ee92e5f2c9d58defb3cc3946940d492c39d756

Tree: d6cce311efc20467e29b1a926c6925634076def3

Author: Dino

Committer: GitHub

## Message

```
agent_ui: Improve quote selections to consider message being edited (#39947)

- Update `AcpThreadView.insert_selections` to take into account whether
the user is currently editing an existing message and, if it is, insert
the selection into that message instead of the thread's message editor
- Update Window's default keymap to use the `agent::QuoteSelection`
action instead of the deprecated `assistant::QuoteSelection` action
- Introduce `AcpThreadView.active_editor` to allow callers to retrieve
either the thread view's message editor or the editor for the message
being edited, in case `AcpThreadView.editing_message` is not `None`
- Improve `AcpThreadView.focus_handle` to focus on the message being
currently edited in case the user navigates back to the editor and then
to the thread view again, all while editing a message
- Add tests for `AcpThreadView.insert_selections`, ensuring that the
selection is inserted in the message being currently edited, if a
message is being edited, or the thread view's message editor if no
message is being edited

Closes #39693 

Release Notes:

- Improved `agent: quote selection` to also work for a message that was
already sent but is being edited

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
```

## Parents

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

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