keymap: Update Prev
to Previous
for consistency (#25909)
Closes #10167 This is take 2 on https://github.com/zed-industries/zed/pull/2341 which was closed due to lack of migrator. This PR contains rename of following keymap actions: ```sh 1. ["editor::GoToPrevHunk", { "center_cursor": true }] -> ["editor::GoToPreviousHunk", { "center_cursor": true }] 2. "editor::GoToPrevDiagnostic" -> "editor::GoToPreviousDiagnostic" 3. "editor::ContextMenuPrev" -> "editor::ContextMenuPrevious" 4. "search::SelectPrevMatch" -> "search::SelectPreviousMatch" 5. "file_finder::SelectPrev" -> "file_finder::SelectPrevious" 6. "menu::SelectPrev" -> "menu::SelectPrevious" 7. "editor::TabPrev" -> "editor::Backtab" ``` Release Notes: - Renamed several keymap actions for consistency (e.g., `GoToPrevHunk` → `GoToPreviousHunk`, `TabPrev` → `Backtab`). Your existing configured keybindings will still work. You can click **"Backup and Update"** at the top of your keymap file to easily update to the new actions. Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
This commit is contained in:
parent
61d584db45
commit
593f3dc1d5
43 changed files with 320 additions and 198 deletions
|
@ -2,14 +2,14 @@ mod registrar;
|
|||
|
||||
use crate::{
|
||||
search_bar::render_nav_button, FocusSearch, NextHistoryQuery, PreviousHistoryQuery, ReplaceAll,
|
||||
ReplaceNext, SearchOptions, SelectAllMatches, SelectNextMatch, SelectPrevMatch,
|
||||
ReplaceNext, SearchOptions, SelectAllMatches, SelectNextMatch, SelectPreviousMatch,
|
||||
ToggleCaseSensitive, ToggleRegex, ToggleReplace, ToggleSelection, ToggleWholeWord,
|
||||
};
|
||||
use any_vec::AnyVec;
|
||||
use anyhow::Context as _;
|
||||
use collections::HashMap;
|
||||
use editor::{
|
||||
actions::{Tab, TabPrev},
|
||||
actions::{Backtab, Tab},
|
||||
DisplayPoint, Editor, EditorElement, EditorSettings, EditorStyle,
|
||||
};
|
||||
use futures::channel::oneshot;
|
||||
|
@ -380,7 +380,7 @@ impl Render for BufferSearchBar {
|
|||
ui::IconName::ChevronLeft,
|
||||
self.active_match_index.is_some(),
|
||||
"Select Previous Match",
|
||||
&SelectPrevMatch,
|
||||
&SelectPreviousMatch,
|
||||
focus_handle.clone(),
|
||||
))
|
||||
.child(render_nav_button(
|
||||
|
@ -477,7 +477,7 @@ impl Render for BufferSearchBar {
|
|||
.track_scroll(&self.scroll_handle)
|
||||
.key_context(key_context)
|
||||
.capture_action(cx.listener(Self::tab))
|
||||
.capture_action(cx.listener(Self::tab_prev))
|
||||
.capture_action(cx.listener(Self::backtab))
|
||||
.on_action(cx.listener(Self::previous_history_query))
|
||||
.on_action(cx.listener(Self::next_history_query))
|
||||
.on_action(cx.listener(Self::dismiss))
|
||||
|
@ -625,13 +625,15 @@ impl BufferSearchBar {
|
|||
this.select_next_match(action, window, cx);
|
||||
}
|
||||
}));
|
||||
registrar.register_handler(WithResults(|this, action: &SelectPrevMatch, window, cx| {
|
||||
if this.supported_options(cx).find_in_results {
|
||||
cx.propagate();
|
||||
} else {
|
||||
this.select_prev_match(action, window, cx);
|
||||
}
|
||||
}));
|
||||
registrar.register_handler(WithResults(
|
||||
|this, action: &SelectPreviousMatch, window, cx| {
|
||||
if this.supported_options(cx).find_in_results {
|
||||
cx.propagate();
|
||||
} else {
|
||||
this.select_prev_match(action, window, cx);
|
||||
}
|
||||
},
|
||||
));
|
||||
registrar.register_handler(WithResults(
|
||||
|this, action: &SelectAllMatches, window, cx| {
|
||||
if this.supported_options(cx).find_in_results {
|
||||
|
@ -996,7 +998,7 @@ impl BufferSearchBar {
|
|||
|
||||
fn select_prev_match(
|
||||
&mut self,
|
||||
_: &SelectPrevMatch,
|
||||
_: &SelectPreviousMatch,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
|
@ -1333,7 +1335,7 @@ impl BufferSearchBar {
|
|||
cx.stop_propagation();
|
||||
}
|
||||
|
||||
fn tab_prev(&mut self, _: &TabPrev, window: &mut Window, cx: &mut Context<Self>) {
|
||||
fn backtab(&mut self, _: &Backtab, window: &mut Window, cx: &mut Context<Self>) {
|
||||
// Search -> Replace -> Search
|
||||
let focus_handle = if self.replace_enabled && self.query_editor_focused {
|
||||
self.replacement_editor.focus_handle(cx)
|
||||
|
@ -1699,7 +1701,7 @@ mod tests {
|
|||
});
|
||||
|
||||
search_bar.update_in(cx, |search_bar, window, cx| {
|
||||
search_bar.select_prev_match(&SelectPrevMatch, window, cx);
|
||||
search_bar.select_prev_match(&SelectPreviousMatch, window, cx);
|
||||
assert_eq!(
|
||||
editor.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(3), 56)..DisplayPoint::new(DisplayRow(3), 58)]
|
||||
|
@ -1710,7 +1712,7 @@ mod tests {
|
|||
});
|
||||
|
||||
search_bar.update_in(cx, |search_bar, window, cx| {
|
||||
search_bar.select_prev_match(&SelectPrevMatch, window, cx);
|
||||
search_bar.select_prev_match(&SelectPreviousMatch, window, cx);
|
||||
assert_eq!(
|
||||
editor.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(3), 11)..DisplayPoint::new(DisplayRow(3), 13)]
|
||||
|
@ -1721,7 +1723,7 @@ mod tests {
|
|||
});
|
||||
|
||||
search_bar.update_in(cx, |search_bar, window, cx| {
|
||||
search_bar.select_prev_match(&SelectPrevMatch, window, cx);
|
||||
search_bar.select_prev_match(&SelectPreviousMatch, window, cx);
|
||||
assert_eq!(
|
||||
editor.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(0), 41)..DisplayPoint::new(DisplayRow(0), 43)]
|
||||
|
@ -1742,7 +1744,7 @@ mod tests {
|
|||
});
|
||||
search_bar.update_in(cx, |search_bar, window, cx| {
|
||||
assert_eq!(search_bar.active_match_index, Some(1));
|
||||
search_bar.select_prev_match(&SelectPrevMatch, window, cx);
|
||||
search_bar.select_prev_match(&SelectPreviousMatch, window, cx);
|
||||
assert_eq!(
|
||||
editor.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(0), 41)..DisplayPoint::new(DisplayRow(0), 43)]
|
||||
|
@ -1784,7 +1786,7 @@ mod tests {
|
|||
});
|
||||
search_bar.update_in(cx, |search_bar, window, cx| {
|
||||
assert_eq!(search_bar.active_match_index, Some(2));
|
||||
search_bar.select_prev_match(&SelectPrevMatch, window, cx);
|
||||
search_bar.select_prev_match(&SelectPreviousMatch, window, cx);
|
||||
assert_eq!(
|
||||
editor.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(3), 56)..DisplayPoint::new(DisplayRow(3), 58)]
|
||||
|
@ -1826,7 +1828,7 @@ mod tests {
|
|||
});
|
||||
search_bar.update_in(cx, |search_bar, window, cx| {
|
||||
assert_eq!(search_bar.active_match_index, Some(0));
|
||||
search_bar.select_prev_match(&SelectPrevMatch, window, cx);
|
||||
search_bar.select_prev_match(&SelectPreviousMatch, window, cx);
|
||||
assert_eq!(
|
||||
editor.update(cx, |editor, cx| editor.selections.display_ranges(cx)),
|
||||
[DisplayPoint::new(DisplayRow(3), 56)..DisplayPoint::new(DisplayRow(3), 58)]
|
||||
|
@ -2039,7 +2041,7 @@ mod tests {
|
|||
);
|
||||
});
|
||||
search_bar.update(cx, |search_bar, cx| {
|
||||
search_bar.select_prev_match(&SelectPrevMatch, window, cx);
|
||||
search_bar.select_prev_match(&SelectPreviousMatch, window, cx);
|
||||
});
|
||||
})
|
||||
.unwrap();
|
||||
|
@ -2047,7 +2049,7 @@ mod tests {
|
|||
.update(cx, |_, window, cx| {
|
||||
assert!(
|
||||
editor.read(cx).is_focused(window),
|
||||
"Should still have editor focused after SelectPrevMatch"
|
||||
"Should still have editor focused after SelectPreviousMatch"
|
||||
);
|
||||
|
||||
search_bar.update(cx, |search_bar, cx| {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
buffer_search::Deploy, BufferSearchBar, FocusSearch, NextHistoryQuery, PreviousHistoryQuery,
|
||||
ReplaceAll, ReplaceNext, SearchOptions, SelectNextMatch, SelectPrevMatch, ToggleCaseSensitive,
|
||||
ToggleIncludeIgnored, ToggleRegex, ToggleReplace, ToggleWholeWord,
|
||||
ReplaceAll, ReplaceNext, SearchOptions, SelectNextMatch, SelectPreviousMatch,
|
||||
ToggleCaseSensitive, ToggleIncludeIgnored, ToggleRegex, ToggleReplace, ToggleWholeWord,
|
||||
};
|
||||
use anyhow::Context as _;
|
||||
use collections::{HashMap, HashSet};
|
||||
|
@ -90,7 +90,7 @@ pub fn init(cx: &mut App) {
|
|||
);
|
||||
register_workspace_action(
|
||||
workspace,
|
||||
move |search_bar, action: &SelectPrevMatch, window, cx| {
|
||||
move |search_bar, action: &SelectPreviousMatch, window, cx| {
|
||||
search_bar.select_prev_match(action, window, cx)
|
||||
},
|
||||
);
|
||||
|
@ -1440,9 +1440,9 @@ impl ProjectSearchBar {
|
|||
self.cycle_field(Direction::Next, window, cx);
|
||||
}
|
||||
|
||||
fn tab_previous(
|
||||
fn backtab(
|
||||
&mut self,
|
||||
_: &editor::actions::TabPrev,
|
||||
_: &editor::actions::Backtab,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
|
@ -1697,7 +1697,7 @@ impl ProjectSearchBar {
|
|||
|
||||
fn select_prev_match(
|
||||
&mut self,
|
||||
_: &SelectPrevMatch,
|
||||
_: &SelectPreviousMatch,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
|
@ -1896,7 +1896,7 @@ impl Render for ProjectSearchBar {
|
|||
move |window, cx| {
|
||||
Tooltip::for_action_in(
|
||||
"Go To Previous Match",
|
||||
&SelectPrevMatch,
|
||||
&SelectPreviousMatch,
|
||||
&focus_handle,
|
||||
window,
|
||||
cx,
|
||||
|
@ -2095,7 +2095,7 @@ impl Render for ProjectSearchBar {
|
|||
cx.stop_propagation();
|
||||
}))
|
||||
.capture_action(cx.listener(|this, action, window, cx| {
|
||||
this.tab_previous(action, window, cx);
|
||||
this.backtab(action, window, cx);
|
||||
cx.stop_propagation();
|
||||
}))
|
||||
.on_action(cx.listener(|this, action, window, cx| this.confirm(action, window, cx)))
|
||||
|
|
|
@ -30,7 +30,7 @@ actions!(
|
|||
ToggleReplace,
|
||||
ToggleSelection,
|
||||
SelectNextMatch,
|
||||
SelectPrevMatch,
|
||||
SelectPreviousMatch,
|
||||
SelectAllMatches,
|
||||
NextHistoryQuery,
|
||||
PreviousHistoryQuery,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue