terminal_view: Show "Add to Agent Thread" on first right-click (#50860)

Closes #50844

## Summary

- When right-clicking a word in the terminal with no prior selection,
`select_word_at_event_position` queues the selection as an
`InternalEvent` that only syncs to `last_content` on the next update
cycle.
- The context menu was reading `last_content.selection_text` before the
sync, so "Add to Agent Thread" was missing until the second right-click.
- Pass `has_selection` into `deploy_context_menu` from the call site,
where we already know whether a word was just selected.

## Test plan

- [x] Open a terminal in Zed
- [x] Run a command that produces output (e.g. `echo foo bar baz`)
- [x] Ensure there is no existing selection
- [x] Right-click on a word — "Add to Agent Thread" appears on the first
right-click
- [x] Right-click with an existing selection — "Add to Agent Thread"
still appears
- [x] Right-click with no text under cursor — context menu still works
correctly

## Videos:
### Before

[agent_test_before.webm](https://github.com/user-attachments/assets/d913a05b-6189-40a4-8eee-3660be8c3647)


### After

[agent_test_after.webm](https://github.com/user-attachments/assets/ceacc617-71b2-442f-a150-305867f9dd5f)



Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed "Add to Agent Thread" missing from terminal context menu on
first right-click when no prior selection existed.

---------

Co-authored-by: Lukas Wirth <lukas@zed.dev>
3b98fca338João Soares committed on 4/23/2026, 12:18:36 PM· committed by GitHubparentcb25ef9
1 file changedLine totals unavailable