Skip to content

text_finder: Seed text finder query from active project and buffer search - #59779

Merged
yara-blue merged 4 commits into
zed-industries:mainfrom
ozacod:feat/buffer-to-textfinder
Jun 24, 2026
Merged

text_finder: Seed text finder query from active project and buffer search#59779
yara-blue merged 4 commits into
zed-industries:mainfrom
ozacod:feat/buffer-to-textfinder

Conversation

@ozacod

@ozacod ozacod commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

When opening the text finder (text_finder::Toggle), pre-populate its query the same way project search already seeds itself. Previously seed_query only asked the active editor for the word under the cursor, so opening the text finder from a project search tab or a focused buffer search bar started empty.

seed_query now tries these sources in priority order:

  1. Active project search — its current query (ProjectSearchView::search_query_text).
  2. Focused buffer search bar — its query, reusing project search's existing buffer_search_query helper (promoted from private to pub(crate) so there's one source of truth rather than a copy).
  3. Word under the cursor — the existing query_suggestion fallback, still honoring the seed_search_query_from_cursor setting.

This mirrors how project search is fed from the buffer search bar (existing_or_new_search), keeping the seeding behavior consistent across the three search surfaces.

Testing

  • Manual: open project search with a query → toggle text finder → query carries over; cmd+f with a query focused → toggle text finder → query carries over; otherwise the word under the cursor seeds it as before.

Release Notes:

  • Improved text finder to pre-fill its query from the active project search or buffer search

When opening the text finder (text_finder::Toggle), pre-populate its query
the same way project search already seeds itself. seed_query now tries, in
priority order: the active project search's query, then a focused buffer
search bar's query (reusing project search's buffer_search_query helper,
promoted to pub(crate)), then the word under the cursor.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 23, 2026
@ozacod
ozacod marked this pull request as ready for review June 23, 2026 18:21
@ozacod ozacod changed the title search: Seed text finder query from active project and buffer search text_finder: Seed text finder query from active project and buffer search Jun 23, 2026
@yara-blue yara-blue self-assigned this Jun 24, 2026
@yara-blue
yara-blue enabled auto-merge June 24, 2026 10:13
@yara-blue

yara-blue commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Again thank you so much for helping out with these!

I planning to make a list of all the things we wanted to add but could not find the time for. Want me to tag you in that?

@yara-blue
yara-blue force-pushed the feat/buffer-to-textfinder branch from 1a2dd5d to ea315d2 Compare June 24, 2026 13:06
@ozacod

ozacod commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Again thank you so much for helping out with these!

I planning to make a list of all the things we wanted to add but could not find the time for. Want me to tag you in that?

Yes, I would be glad to help out

@yara-blue
yara-blue added this pull request to the merge queue Jun 24, 2026
Merged via the queue into zed-industries:main with commit 6c923cc Jun 24, 2026
34 checks passed
weihuoya pushed a commit to weihuoya/zed that referenced this pull request Jun 25, 2026
…arch (zed-industries#59779)

## Summary

When opening the text finder (`text_finder::Toggle`), pre-populate its
query the same way project search already seeds itself. Previously
`seed_query` only asked the active editor for the word under the cursor,
so opening the text finder from a project search tab or a focused buffer
search bar started empty.

`seed_query` now tries these sources in priority order:

1. **Active project search** — its current query
(`ProjectSearchView::search_query_text`).
2. **Focused buffer search bar** — its query, reusing project search's
existing `buffer_search_query` helper (promoted from private to
`pub(crate)` so there's one source of truth rather than a copy).
3. **Word under the cursor** — the existing `query_suggestion` fallback,
still honoring the `seed_search_query_from_cursor` setting.

This mirrors how project search is fed from the buffer search bar
(`existing_or_new_search`), keeping the seeding behavior consistent
across the three search surfaces.

## Testing

- Manual: open project search with a query → toggle text finder → query
carries over; cmd+f with a query focused → toggle text finder → query
carries over; otherwise the word under the cursor seeds it as before.

Release Notes:

- Improved text finder to pre-fill its query from the active project
search or buffer search

---------

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
Co-authored-by: Yara 🏳️‍⚧️ <git@yara.blue>
@yara-blue yara-blue added the area:pickers Everything related to pickers that are in a modal label Jun 25, 2026
@yara-blue yara-blue removed their assignment Aug 3, 2026
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…arch (zed-industries#59779)

## Summary

When opening the text finder (`text_finder::Toggle`), pre-populate its
query the same way project search already seeds itself. Previously
`seed_query` only asked the active editor for the word under the cursor,
so opening the text finder from a project search tab or a focused buffer
search bar started empty.

`seed_query` now tries these sources in priority order:

1. **Active project search** — its current query
(`ProjectSearchView::search_query_text`).
2. **Focused buffer search bar** — its query, reusing project search's
existing `buffer_search_query` helper (promoted from private to
`pub(crate)` so there's one source of truth rather than a copy).
3. **Word under the cursor** — the existing `query_suggestion` fallback,
still honoring the `seed_search_query_from_cursor` setting.

This mirrors how project search is fed from the buffer search bar
(`existing_or_new_search`), keeping the seeding behavior consistent
across the three search surfaces.

## Testing

- Manual: open project search with a query → toggle text finder → query
carries over; cmd+f with a query focused → toggle text finder → query
carries over; otherwise the word under the cursor seeds it as before.

Release Notes:

- Improved text finder to pre-fill its query from the active project
search or buffer search

---------

Co-authored-by: ozacod <ozacod@users.noreply.github.com>
Co-authored-by: Yara 🏳️‍⚧️ <git@yara.blue>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:pickers Everything related to pickers that are in a modal cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants