Improve Find/Replace shortcuts (#10297)
This PR changes ways the Find/Replace functionality in the Buffer/Project Search is accessible via shortcuts. It makes those panels work the same way as in VS Code and Sublime Text. The details are described in the issue: [Make Find/Replace easier to use](https://github.com/zed-industries/zed/issues/9142) There's a difficulty with the Linux keybindings: VS Code uses on MacOS (this PR replicates it): | Action | Buffer Search | Project Search | | --- | --- | --- | | Find | `cmd-f` | `cmd-shift-f` | | Replace | `cmd-alt-f` | `cmd-shift-h` | VS Code uses on Linux (this PR replicates all but one): | Action | Buffer Search | Project Search | | --- | --- | --- | | Find | `ctrl-f` | `ctrl-shift-f` | | Replace | `ctrl-h` ❗ | `ctrl-shift-h` | The problem is that `ctrl-h` is already taken by the `editor::Backspace` action in Zed on Linux. There's two options here: 1. Change keybinding for `editor::Backspace` on Linux to something else, and use `ctrl-h` for the "replace in buffer" action. 2. Use some other keybinding on Linux in Zed. This PR introduces `ctrl-r` for this purpose, though I'm not sure it's the best choice. What do you think? fixes #9142 Release Notes: - Improved access to "Find/Replace in Buffer" and "Find/Replace in Files" via shortcuts (#9142). Optionally, include screenshots / media showcasing your addition that can be included in the release notes. - N/A
This commit is contained in:
parent
cc367d43d6
commit
935e0d547e
8 changed files with 103 additions and 28 deletions
|
@ -86,6 +86,12 @@ pub struct RevealInProjectPanel {
|
|||
pub entry_id: Option<u64>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Deserialize)]
|
||||
pub struct DeploySearch {
|
||||
#[serde(default)]
|
||||
pub replace_enabled: bool,
|
||||
}
|
||||
|
||||
impl_actions!(
|
||||
pane,
|
||||
[
|
||||
|
@ -93,7 +99,8 @@ impl_actions!(
|
|||
CloseActiveItem,
|
||||
CloseInactiveItems,
|
||||
ActivateItem,
|
||||
RevealInProjectPanel
|
||||
RevealInProjectPanel,
|
||||
DeploySearch,
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -107,7 +114,6 @@ actions!(
|
|||
CloseItemsToTheLeft,
|
||||
CloseItemsToTheRight,
|
||||
GoBack,
|
||||
DeploySearch,
|
||||
GoForward,
|
||||
ReopenClosedItem,
|
||||
SplitLeft,
|
||||
|
@ -117,6 +123,14 @@ actions!(
|
|||
]
|
||||
);
|
||||
|
||||
impl DeploySearch {
|
||||
pub fn find() -> Self {
|
||||
Self {
|
||||
replace_enabled: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const MAX_NAVIGATION_HISTORY_LEN: usize = 1024;
|
||||
|
||||
pub enum Event {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue