This fixes the issue of `Cmd-shift-f` not refocusing the search bar when
a project-wide search already exists.
It also fixes the handlers for "search in new" and "new search".
Co-authored-by: Kirill <kirill@zed.dev>
Adding the typos crate to our CI will take some doing, as we have
several tests which rely on typos in various ways (e.g. checking state
as the user types), but I thought I'd take a first stab at fixing what
it finds.
Release Notes:
- N/A
When the `List` element's state is `ListState::reset()`, it eagerly
trashes it's cached element heights in anticipation of a prompt render.
But, due to the recent `display_layer` changes, that re-render is not
always forthcoming. This is a problem for `ListState::scroll()`, which
depends on these cached elements to correctly calculate the new logical
scroll offset.
Solutions we attempted:
- Cache the element heights and continue the scroll calculation
- This was conceptually incorrect, reset should only be called when the
underlying data has been changed, making any calculation with the old
results meaningless.
- Lazily re-compute the element heights in scroll
- Beyond being a non-trivial refactor, this would probably also cause us
to double-render the list in a single frame, which is bad.
- Cache the scroll offset and only calculate it in paint
- This solution felt awkward to implement and meant we can't supply
synchronous list scroll events.
- Delay resetting until paint
- This means that all of the other APIs that `ListState` supplies would
give temporarily incorrect results, worsening the problem
Given these issues, we settled on the solution with the least
compromises: drop scroll events if the state has been `reset()` between
`paint()` and `scroll()`. This shifts the responsibility for the problem
out of the List element and into consumers of `List`, if you want
perfectly smooth scrolling then you need to use `reset()` judiciously
and prefer `splice()`.
That said, I tested this by aggressively scrolling the Collab panel, and
it seems to work as well as it did before.
This PR also includes some initial testing infrastructure for working
with input from the platform and rendered elements.
Release Notes:
- N/A
This adjusts the solution in
https://github.com/zed-industries/zed/pull/4014 to fix the double-focus
issue, allowing each pane's project search to work independently.
Release Notes:
- Changed the name of the `workspace::DeploySearch` action to
`pane::DeploySearch` and changed it's behavior to open a new search OR
focus an existing project search in the current pane.
(https://github.com/zed-industries/community/issues/2395)
This PR renames the `h_stack` and `v_stack` to `h_flex` and `v_flex`,
respectively.
We were previously using `h_stack` and `v_stack` to match SwiftUI, but
`h_flex` and `v_flex` fit better with the web/flexbox terminology that
the rest of GPUI uses.
Additionally, we were already calling the utility functions used to
implement `h_stack` and `v_stack` by the new names.
Release Notes:
- N/A
This PR updates the `IconButton`s used to control the buffer search
options to use the `.selected` state to denote when they are active.
This matches what we are doing in the project search.
This should improve the contrast in certain themes.
Release Notes:
- Improved the active style for the search options in buffer search.
This PR renames the `IconElement` component to just `Icon`.
This better matches the rest of our components, as `IconElement` was the
only one using this naming convention.
The `Icon` enum has been renamed to `IconName` to free up the name.
I was trying to come up with a way that would allow rendering an
`Icon::Zed` directly (and thus make the `IconElement` a hidden part of
the API), but I couldn't come up with a way to do this cleanly.
Release Notes:
- N/A
This PR iterates on the design of the project search bar:
- Mode selections have been updated to use `ToggleButton`s
- Spacing has been added between the various elements.
Release Notes:
- Improved the look of the project search bar.
This PR updates the project search empty state to use the same
background color as the editor.
Release Notes:
- Updated the background color of the project search's empty state to
match the editor background.
Add a `workspace::DeploySearch` action and use it as a default for
"cmd-shift-f" binding. This action opens existing search tab if it
exists, or creates a new one otherwise. `workspace::NewSearch` action is
still available and always opens an existing search tab.
Release Notes:
- Added a `workspace::DeploySearch` action and use it as a default for
"cmd-shift-f" binding. `workspace::NewSearch` action is still available
and always opens an existing search tab.
This commit adds a Registrar trait for use by search crate. Registrar can register actions on some target and search can utilize that trait to opaquely add actions on that target.
Notably, search is now opt-in (it always was in zed2 actually). Having editor doesn't make it searchable straight out of the gate. You might have to call BufferSearchBar::new a bunch more.
Add a `workspace::DeploySearch` action and use it as a default for "cmd-shift-f" binding.
This action opens existing search tab if it exists, or creates a new one otherwise.
`workspace::NewSearch` action is still available and always opens an existing search tab.