Closes#36300
This PR follows Windows conventions by introducing
`KeybindingKeystroke`, so shortcuts now show up as `ctrl-shift-4`
instead of `ctrl-$`.
It also fixes issues with keyboard layouts: when `use_key_equivalents`
is set to true, keys are remapped based on their virtual key codes. For
example, `ctrl-\` on a standard English layout will be mapped to
`ctrl-ё` on a Russian layout.
Release Notes:
- N/A
---------
Co-authored-by: Kate <kate@zed.dev>
With the previous commit, both `BufferSearchBar` and `ProjectSearchView`
have been updated to no longer rely on `PatternItems`, seeing as
`SearchQuery::regex` is now responsible for handling pattern items.
This commit removes the `search::pattern_items` module, since there's no
longer other modules needing its functionality.
In order to simplify the implementation of pattern items in search
queries, this commit updates the `project::search::SearchQuery::regex`
function so as to support both `\\c` and `\\C` in the provided query.
This means that we no longer need to have both `BufferSearchBar` and
`ProjectSearchView` handling pattern items, so the
`search::pattern_items` module can now safely be removed.
It's worth noting that, since these are now handled at the `SearchQuery`
level, this removes the updates to the UI regarding search options, that
were being triggered by the pattern items being processed and applied to
the search options.
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
## Fix: Preserve Helix mode when using search
### Problem
When using `buffer search: deploy` in Helix mode, pressing Enter to
dismiss the search incorrectly returned to Vim NORMAL mode instead of
Helix NORMAL mode.
### Root Cause
The `search_deploy` function was resetting the entire `SearchState` to
default values when buffer search: deploy was activated. Since the
default `Mode` is `Normal`, this caused `prior_mode` to be set to Vim's
Normal mode regardless of the actual mode before search.
### Solution
Modified `search_deploy` to preserve the current mode when resetting
search state:
- Store the current mode before resetting
- Reset search state to default
- Restore the saved mode to `prior_mode`
This ensures the editor returns to the correct mode (Helix NORMAL or Vim
NORMAL) after dismissing buffer search.
### Settings
I was able to reproduce and then test the fix was successful with the
following config and have also tested with vim: default_mode commented
out to ensure that's not influencing the mode selection flow:
```
"helix_mode": true,
"vim_mode": true,
"vim": {
"default_mode": "helix_normal"
},
```
This is on Kubuntu 24.04.
The following test combinations pass locally:
- `cargo test -p search`
- `cargo test -p vim`
- `cargo test -p editor`
- `cargo test -p workspace`
- `cargo test -p gpui -- vim`
- `cargo test -p gpui -- helix`
Release Notes:
- Fixed Helix mode switching to Vim normal mode after using `buffer
search: deploy` to search
Closes#36872
Update the `search::project_search::ProjectSearchView` implementation in
order to allow users to leverage pattern items in the search query.
Add a very basic `test_pattern_items` test to `search::project_search`
in order to test how the `apply_pattern_items` method affects the
`ProjectSearchView.search_options` value depending on the query editor's
text. Unfortunately I wasn't having much luck adding a text similar to
the one for `BufferSearchBar` where we actually simulate the user's
input and keystrokes, so definitely something that can be improved upon.
Update the way pattern items are implemented so that, instead of saving
these in an array with the character representation, the search option
and its value, it now is a `PatternItem` enum, and the enum implements
several methods:
- `character` - Returns the character representation for the pattern
item item, without the backslash.
- `search_option` - Returns the search option and its desired value.
The `TryFrom<&str>` trait is also implemented for `PatternItem` so that
we can simply build a `PatternItem` from a string like `"\\c"`.
With the current implementation of pattern items, it's impossible to
search for strings like `\c` in buffers as, even when using `\\c`, the
`\c` suffix will be interpreted as a pattern item. This commit updates
the regex used to find the pattern items so as to ensure that the
preceding character is never a `\` and, if it is, it's considered that
the user is searching for a slash instead of trying to use a pattern
item.
Fix issue where having conflicting pattern items in the search query
could lead to erroneous results. For example, if the search query was
`test\c\C\c`, one would expect for the case sensitivity option to be
disabled, seeing as `\c` is the last pattern item. However, since the
code was simply iterating over `PATTERN_ITEMS`, it did not take into
consideration that:
1. The same pattern item could appear more than once in the query 2. The
order of the pattern item in the query should take precedence over the
order of the pattern item in `PATTERN_ITEMS`
As such, this commit fixes that so that the implementation actually
iterates over the pattern items capture in the query, ensuring that, if
`\c\C\c` is found, the last pattern item is the one that will be
applied.
This commit fixes an issue with the pattern items implementation where,
in vim mode, deploying the buffer search through `/` and then typing any
character would automatically disable the regex setting. After some
research this was tracked down to the fact that the `default_options`
don't actually contain all of the settings that are enabled when the
buffer search bar is shown with `/`, as the vim layer is the one that
ends up calling the `set_search_options` method with the
`SearchOptions::REGEX` option enabled. Calling this method doesn't
actually update the `default_options`, and I believe this should
probably not be changed.
As such, in order to prevent this issue, this commit introduces a new
`pattern_item_options` vector to the `BufferSearchBar`, which simply
keeps track of the search options that were either enabled/disabled by
pattern items in the search query, that actually had impact on the
search options. By keeping track of this, one can easily just revert the
options, by calling `toggle_search_option`, seeing as we only keep track
of the ones that actually had any effect on the options, and revert to
all of the options that were enabled when the buffer search bar was
deployed, be it on the `default_options` or not.
I believe the current implementation can probably be improved with a
simple `SearchOptions` and then using the `exclusion` or `intersection`
methods but have yet to dedicate more time to this. On the other hand,
there's yet another issue that surfaced while working on this:
1. Type `Main\c\C\c` in the search query 2. Confirm that
case-sensitivity is enabled
This happens because we're not actually keeping track of the order the
pattern items are applied in the search query, so the order they're
defined in `PATTERN_ITEMS` takes precendence, we'll likely need to
capture the matches so we can then actually leverage the order to
determine what the final option should be.
Add a very simple test that verifies the behaviour of
`apply_pattern_items` when the search query is updated. In practice it
would be best to be able to actually simulate the whole flow where
`EditorEvent::Edited` is triggered but I haven't managed to figure out
how to do that just yet.
This might be a bit of an overkill for the time being, but I expect that
when the array of pattern items grows, it might be faster to replace the
pattern items with a regex instead of iterating over the array.
Update the way the search query in the buffer search bar is handled in
order to support pattern items. Right now only two pattern items are
supported:
- `\c` – When \c is provided in the search query, it disables the case
sensitivity search option
- `\C` – When \C is provided in the search query, it enables the case
sensitivity search option
This feature takes precedence over the `BufferSearchBar.search_options`,
but it ensures that, if any search option was previously
enabled/disabled and it was disabled/enabled by a pattern item, it'll
return to its initial state when the pattern item is deleted.
Previously, we wouldn't finalize the diff if an error occurred during
editing or the tool call was canceled.
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Closes #ISSUE
Release Notes:
- The environment of original remote dev cannot be changed without sudo
because of the behavior of "sh -c". This PR changes "sh -c" to "sh -lc"
to let the shell source $HOME/.profile and support customized
environment like customized $PATH variable.
Related #4642
Compatible with #34136
Release Notes:
- Helix: `Shift+R` works as Paste instead of taking you to ReplaceMode
- Helix: `g .` goes to last modification place (similar to `. in vim)
Closes#33736
Use `thiserror` to implement error stack and `anyhow` to report is to
user.
Also move some code from main to remote_server to have better crate
isolation.
Release Notes:
- N/A
---------
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Support to show diagnostics on the tab switcher in the same way they are
displayed on the tab bar. This follows the setting
`tabs.show_diagnostics`.
This will improve user experience when disabling the tab bar and still
being able to see the diagnostics when switching tabs
Preview:
<img width="768" height="523" alt="Screenshot From 2025-07-16 11-02-42"
src="https://github.com/user-attachments/assets/308873ba-0458-485d-ae05-0de7c1cdfb28"
/>
Release Notes:
- Added diagnostics indicators to the tab switcher
---------
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Adds support for per-session prompt capabilities and capability changes
on the Zed side (ACP itself still only has per-connection static
capabilities for now), and uses it to reflect image support accurately
in 1PA threads based on the currently-selected model.
Release Notes:
- N/A
Reverts zed-industries/zed#36012
We thought we didn't need this UI, but it turns out it was load bearing
:)
Release Notes:
- Restored the zoomed panel padding