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:
smit 2025-03-03 17:44:49 +05:30 committed by GitHub
parent 61d584db45
commit 593f3dc1d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 320 additions and 198 deletions

View file

@ -205,7 +205,7 @@ pub struct GoToHunk {
#[derive(PartialEq, Clone, Deserialize, Default, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct GoToPrevHunk {
pub struct GoToPreviousHunk {
#[serde(default)]
pub center_cursor: bool,
}
@ -241,7 +241,7 @@ impl_actions!(
ExpandExcerptsUp,
FoldAt,
GoToHunk,
GoToPrevHunk,
GoToPreviousHunk,
HandleInput,
MoveDownByLines,
MovePageDown,
@ -281,7 +281,7 @@ gpui::actions!(
ContextMenuFirst,
ContextMenuLast,
ContextMenuNext,
ContextMenuPrev,
ContextMenuPrevious,
ConvertToKebabCase,
ConvertToLowerCamelCase,
ConvertToLowerCase,
@ -325,7 +325,7 @@ gpui::actions!(
GoToDiagnostic,
GoToImplementation,
GoToImplementationSplit,
GoToPrevDiagnostic,
GoToPreviousDiagnostic,
GoToTypeDefinition,
GoToTypeDefinitionSplit,
HalfPageDown,
@ -420,7 +420,7 @@ gpui::actions!(
SplitSelectionIntoLines,
SwitchSourceHeader,
Tab,
TabPrev,
Backtab,
ToggleAutoSignatureHelp,
ToggleGitBlame,
ToggleGitBlameInline,

View file

@ -7192,7 +7192,7 @@ impl Editor {
});
}
pub fn tab_prev(&mut self, _: &TabPrev, window: &mut Window, cx: &mut Context<Self>) {
pub fn backtab(&mut self, _: &Backtab, window: &mut Window, cx: &mut Context<Self>) {
if self.move_to_prev_snippet_tabstop(window, cx) {
return;
}
@ -9236,7 +9236,7 @@ impl Editor {
pub fn context_menu_prev(
&mut self,
_: &ContextMenuPrev,
_: &ContextMenuPrevious,
_window: &mut Window,
cx: &mut Context<Self>,
) {
@ -11263,7 +11263,7 @@ impl Editor {
fn go_to_prev_diagnostic(
&mut self,
_: &GoToPrevDiagnostic,
_: &GoToPreviousDiagnostic,
window: &mut Window,
cx: &mut Context<Self>,
) {
@ -11476,7 +11476,7 @@ impl Editor {
fn go_to_prev_hunk(
&mut self,
action: &GoToPrevHunk,
action: &GoToPreviousHunk,
window: &mut Window,
cx: &mut Context<Self>,
) {

View file

@ -2965,7 +2965,7 @@ async fn test_indent_outdent(cx: &mut TestAppContext) {
four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
«oneˇ» «twoˇ»
three
@ -2985,7 +2985,7 @@ async fn test_indent_outdent(cx: &mut TestAppContext) {
ˇ» four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
one two
t«hree
@ -3010,7 +3010,7 @@ async fn test_indent_outdent(cx: &mut TestAppContext) {
ˇ three
four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
one two
ˇthree
@ -3044,13 +3044,13 @@ async fn test_indent_outdent_with_hard_tabs(cx: &mut TestAppContext) {
three
four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
\t«oneˇ» «twoˇ»
three
four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
«oneˇ» «twoˇ»
three
@ -3075,13 +3075,13 @@ async fn test_indent_outdent_with_hard_tabs(cx: &mut TestAppContext) {
\t\tt«hree
ˇ»four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
one two
\tt«hree
ˇ»four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
one two
t«hree
@ -3094,7 +3094,7 @@ async fn test_indent_outdent_with_hard_tabs(cx: &mut TestAppContext) {
ˇthree
four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
one two
ˇthree
@ -3106,7 +3106,7 @@ async fn test_indent_outdent_with_hard_tabs(cx: &mut TestAppContext) {
\tˇthree
four
"});
cx.update_editor(|e, window, cx| e.tab_prev(&TabPrev, window, cx));
cx.update_editor(|e, window, cx| e.backtab(&Backtab, window, cx));
cx.assert_editor_state(indoc! {"
one two
ˇthree
@ -3211,7 +3211,7 @@ fn test_indent_outdent_with_excerpts(cx: &mut TestAppContext) {
"},
cx,
);
editor.tab_prev(&TabPrev, window, cx);
editor.backtab(&Backtab, window, cx);
assert_text_with_selections(
&mut editor,
indoc! {"
@ -11026,7 +11026,7 @@ async fn go_to_prev_overlapping_diagnostic(executor: BackgroundExecutor, cx: &mu
executor.run_until_parked();
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
@ -11035,7 +11035,7 @@ async fn go_to_prev_overlapping_diagnostic(executor: BackgroundExecutor, cx: &mu
"});
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
@ -11044,7 +11044,7 @@ async fn go_to_prev_overlapping_diagnostic(executor: BackgroundExecutor, cx: &mu
"});
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
@ -11053,7 +11053,7 @@ async fn go_to_prev_overlapping_diagnostic(executor: BackgroundExecutor, cx: &mu
"});
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
@ -11133,7 +11133,7 @@ async fn cycle_through_same_place_diagnostics(
// Fourth diagnostic
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
fn func(abc def: i32) -> ˇu32 {
@ -11142,7 +11142,7 @@ async fn cycle_through_same_place_diagnostics(
// Third diagnostic
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
fn func(abc ˇdef: i32) -> u32 {
@ -11151,7 +11151,7 @@ async fn cycle_through_same_place_diagnostics(
// Second diagnostic, same place
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
fn func(abc ˇdef: i32) -> u32 {
@ -11160,7 +11160,7 @@ async fn cycle_through_same_place_diagnostics(
// First diagnostic
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
fn func(abcˇ def: i32) -> u32 {
@ -11169,7 +11169,7 @@ async fn cycle_through_same_place_diagnostics(
// Wrapped over, fourth diagnostic
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_diagnostic(&GoToPrevDiagnostic, window, cx);
editor.go_to_prev_diagnostic(&GoToPreviousDiagnostic, window, cx);
});
cx.assert_editor_state(indoc! {"
fn func(abc def: i32) -> ˇu32 {
@ -11435,7 +11435,7 @@ async fn test_go_to_hunk(executor: BackgroundExecutor, cx: &mut TestAppContext)
cx.update_editor(|editor, window, cx| {
//Wrap around the top of the buffer
for _ in 0..2 {
editor.go_to_prev_hunk(&GoToPrevHunk::default(), window, cx);
editor.go_to_prev_hunk(&GoToPreviousHunk::default(), window, cx);
}
});
@ -11455,7 +11455,7 @@ async fn test_go_to_hunk(executor: BackgroundExecutor, cx: &mut TestAppContext)
);
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_hunk(&GoToPrevHunk::default(), window, cx);
editor.go_to_prev_hunk(&GoToPreviousHunk::default(), window, cx);
});
cx.assert_editor_state(
@ -11474,7 +11474,7 @@ async fn test_go_to_hunk(executor: BackgroundExecutor, cx: &mut TestAppContext)
);
cx.update_editor(|editor, window, cx| {
editor.go_to_prev_hunk(&GoToPrevHunk::default(), window, cx);
editor.go_to_prev_hunk(&GoToPreviousHunk::default(), window, cx);
});
cx.assert_editor_state(
@ -11494,7 +11494,7 @@ async fn test_go_to_hunk(executor: BackgroundExecutor, cx: &mut TestAppContext)
cx.update_editor(|editor, window, cx| {
for _ in 0..2 {
editor.go_to_prev_hunk(&GoToPrevHunk::default(), window, cx);
editor.go_to_prev_hunk(&GoToPreviousHunk::default(), window, cx);
}
});
@ -12229,7 +12229,7 @@ async fn test_completions_resolve_happens_once(cx: &mut TestAppContext) {
});
cx.run_until_parked();
cx.update_editor(|editor, window, cx| {
editor.context_menu_prev(&ContextMenuPrev, window, cx);
editor.context_menu_prev(&ContextMenuPrevious, window, cx);
});
cx.run_until_parked();
cx.update_editor(|editor, window, cx| {
@ -12419,7 +12419,7 @@ async fn test_completions_default_resolve_data_handling(cx: &mut TestAppContext)
resolved_items.lock().clear();
cx.update_editor(|editor, window, cx| {
editor.context_menu_prev(&ContextMenuPrev, window, cx);
editor.context_menu_prev(&ContextMenuPrevious, window, cx);
});
cx.run_until_parked();
// Completions that have already been resolved are skipped.

View file

@ -19,7 +19,7 @@ use crate::{
BlockId, ChunkReplacement, CursorShape, CustomBlockId, DisplayDiffHunk, DisplayPoint,
DisplayRow, DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode, Editor, EditorMode,
EditorSettings, EditorSnapshot, EditorStyle, ExpandExcerpts, FocusedBlock, GoToHunk,
GoToPrevHunk, GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor,
GoToPreviousHunk, GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor,
InlayHintRefreshReason, InlineCompletion, JumpData, LineDown, LineUp, OpenExcerpts, PageDown,
PageUp, Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection, SoftWrap,
StickyHeaderExcerpt, ToPoint, ToggleFold, COLUMNAR_SELECTION_MODIFIERS, CURSORS_VISIBLE_FOR,
@ -195,7 +195,7 @@ impl EditorElement {
register_action(editor, window, Editor::backspace);
register_action(editor, window, Editor::delete);
register_action(editor, window, Editor::tab);
register_action(editor, window, Editor::tab_prev);
register_action(editor, window, Editor::backtab);
register_action(editor, window, Editor::indent);
register_action(editor, window, Editor::outdent);
register_action(editor, window, Editor::autoindent);
@ -8905,7 +8905,7 @@ fn diff_hunk_controls(
move |window, cx| {
Tooltip::for_action_in(
"Previous Hunk",
&GoToPrevHunk::default(),
&GoToPreviousHunk::default(),
&focus_handle,
window,
cx,