# agent_ui: Improve adding selection as context \(\#52860\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 06dbce41b3bc28d817b31699976de17f9530334f

Requested commit: 06dbce41b3bc28d817b31699976de17f9530334f

Commit: 06dbce41b3bc28d817b31699976de17f9530334f

Tree: 1bab51fe434226d098b7fb4cea778532d664c02d

Author: Danilo Leal

Committer: GitHub

## Message

```
agent_ui: Improve adding selection as context (#52860)

This PR improves adding selection as context particularly for terminals,
making them not depend on open buffers. It also now works adding
selection from a terminal that's no in the panel but as a tab.

Also, I'm removing a behavior introduced in
https://github.com/zed-industries/zed/pull/48045 that turned out to be
confusing, where the selection keybinding would add as context the
content of the current line I'm focused on. I think we shouldn't do this
given that a lot of times, particularly when adding a selection from a
terminal, I'd also end up adding content from a buffer just because my
cursor was previously in there, even without anything selected on it.
Saw myself multiple times deleting the unwanted buffer context crease in
this case. If the keybinding is about _selection_, we should only
trigger it when there's something selected.ing not do anything if there
isn't any selection.

Release Notes:

- Agent: Improved adding selection as context particularly for
terminals, making them not depend on open buffers.
```

## Parents

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

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