From 593f3dc1d5cd15bd93caf0c9e17f887b5a45346b Mon Sep 17 00:00:00 2001 From: smit <0xtimsb@gmail.com> Date: Mon, 3 Mar 2025 17:44:49 +0530 Subject: [PATCH] keymap: Update `Prev` to `Previous` for consistency (#25909) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- assets/keymaps/default-linux.json | 40 +++---- assets/keymaps/default-macos.json | 34 +++--- assets/keymaps/linux/atom.json | 2 +- assets/keymaps/linux/emacs.json | 2 +- assets/keymaps/linux/jetbrains.json | 4 +- assets/keymaps/linux/sublime_text.json | 4 +- assets/keymaps/macos/atom.json | 2 +- assets/keymaps/macos/emacs.json | 2 +- assets/keymaps/macos/jetbrains.json | 6 +- assets/keymaps/macos/sublime_text.json | 4 +- assets/keymaps/macos/textmate.json | 2 +- assets/keymaps/storybook.json | 6 +- assets/keymaps/vim.json | 12 +- crates/assistant2/src/thread_history.rs | 6 +- crates/collab_ui/src/collab_panel.rs | 6 +- crates/editor/src/actions.rs | 10 +- crates/editor/src/editor.rs | 8 +- crates/editor/src/editor_tests.rs | 50 ++++----- crates/editor/src/element.rs | 6 +- crates/file_finder/src/file_finder.rs | 11 +- crates/file_finder/src/file_finder_tests.rs | 6 +- crates/git_ui/src/git_panel.rs | 11 +- crates/git_ui/src/project_diff.rs | 6 +- crates/menu/src/menu.rs | 2 +- crates/migrator/src/migrator.rs | 106 ++++++++++++++++-- crates/outline/src/outline.rs | 2 +- crates/outline_panel/src/outline_panel.rs | 18 +-- crates/picker/src/picker.rs | 9 +- crates/project_panel/src/project_panel.rs | 14 +-- crates/repl/src/notebook/notebook_ui.rs | 2 +- crates/search/src/buffer_search.rs | 44 ++++---- crates/search/src/project_search.rs | 16 +-- crates/search/src/search.rs | 2 +- crates/settings/src/keymap_file.rs | 2 +- crates/storybook/src/stories/picker.rs | 4 +- crates/tab_switcher/src/tab_switcher_tests.rs | 4 +- crates/ui/src/components/context_menu.rs | 11 +- crates/ui/src/components/navigable.rs | 4 +- crates/vim/src/command.rs | 10 +- crates/zed/src/zed/app_menus.rs | 2 +- crates/zed/src/zed/linux_prompts.rs | 9 +- crates/zed/src/zed/quick_action_bar.rs | 8 +- crates/zeta/src/rate_completion_modal.rs | 9 +- 43 files changed, 320 insertions(+), 198 deletions(-) diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index d2ec5d2384..b0c1a517af 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -10,8 +10,8 @@ "pagedown": "menu::SelectLast", "ctrl-n": "menu::SelectNext", "tab": "menu::SelectNext", - "ctrl-p": "menu::SelectPrev", - "shift-tab": "menu::SelectPrev", + "ctrl-p": "menu::SelectPrevious", + "shift-tab": "menu::SelectPrevious", "enter": "menu::Confirm", "ctrl-enter": "menu::SecondaryConfirm", "ctrl-escape": "menu::Cancel", @@ -38,14 +38,14 @@ { "context": "Picker || menu", "bindings": { - "up": "menu::SelectPrev", + "up": "menu::SelectPrevious", "down": "menu::SelectNext" } }, { "context": "Prompt", "bindings": { - "left": "menu::SelectPrev", + "left": "menu::SelectPrevious", "right": "menu::SelectNext" } }, @@ -57,7 +57,7 @@ "backspace": "editor::Backspace", "delete": "editor::Delete", "tab": "editor::Tab", - "shift-tab": "editor::TabPrev", + "shift-tab": "editor::Backtab", "ctrl-k": "editor::CutToEndOfLine", // "ctrl-t": "editor::Transpose", "ctrl-k ctrl-q": "editor::Rewrap", @@ -180,7 +180,7 @@ "ctrl-k c": "assistant::CopyCode", "ctrl-shift-e": "project_panel::ToggleFocus", "ctrl-g": "search::SelectNextMatch", - "ctrl-shift-g": "search::SelectPrevMatch", + "ctrl-shift-g": "search::SelectPreviousMatch", "ctrl-alt-/": "assistant::ToggleModelSelector", "ctrl-k h": "assistant::DeployHistory", "ctrl-k l": "assistant::DeployPromptLibrary", @@ -203,7 +203,7 @@ "escape": "buffer_search::Dismiss", "tab": "buffer_search::FocusEditor", "enter": "search::SelectNextMatch", - "shift-enter": "search::SelectPrevMatch", + "shift-enter": "search::SelectPreviousMatch", "alt-enter": "search::SelectAllMatches", "find": "search::FocusSearch", "ctrl-f": "search::FocusSearch", @@ -290,8 +290,8 @@ "forward": "pane::GoForward", "ctrl-alt-g": "search::SelectNextMatch", "f3": "search::SelectNextMatch", - "ctrl-alt-shift-g": "search::SelectPrevMatch", - "shift-f3": "search::SelectPrevMatch", + "ctrl-alt-shift-g": "search::SelectPreviousMatch", + "shift-f3": "search::SelectPreviousMatch", "shift-find": "project_search::ToggleFocus", "ctrl-shift-f": "project_search::ToggleFocus", "ctrl-alt-shift-h": "search::ToggleReplace", @@ -334,7 +334,7 @@ "ctrl-u": "editor::UndoSelection", "ctrl-shift-u": "editor::RedoSelection", "f8": "editor::GoToDiagnostic", - "shift-f8": "editor::GoToPrevDiagnostic", + "shift-f8": "editor::GoToPreviousDiagnostic", "f2": "editor::Rename", "f12": "editor::GoToDefinition", "alt-f12": "editor::GoToDefinitionSplit", @@ -373,7 +373,7 @@ "alt-y": ["git::StageAndNext", { "whole_excerpt": false }], "alt-shift-y": ["git::UnstageAndNext", { "whole_excerpt": false }], "alt-.": ["editor::GoToHunk", { "center_cursor": true }], - "alt-,": ["editor::GoToPrevHunk", { "center_cursor": true }] + "alt-,": ["editor::GoToPreviousHunk", { "center_cursor": true }] } }, { @@ -536,8 +536,8 @@ { "context": "Editor && (showing_code_actions || showing_completions)", "bindings": { - "ctrl-p": "editor::ContextMenuPrev", - "up": "editor::ContextMenuPrev", + "ctrl-p": "editor::ContextMenuPrevious", + "up": "editor::ContextMenuPrevious", "ctrl-n": "editor::ContextMenuNext", "down": "editor::ContextMenuNext", "pageup": "editor::ContextMenuFirst", @@ -565,7 +565,7 @@ "ctrl-alt-enter": "editor::OpenExcerptsSplit", "ctrl-shift-e": "pane::RevealInProjectPanel", "ctrl-f8": ["editor::GoToHunk", { "center_cursor": true }], - "ctrl-shift-f8": ["editor::GoToPrevHunk", { "center_cursor": true }], + "ctrl-shift-f8": ["editor::GoToPreviousHunk", { "center_cursor": true }], "ctrl-enter": "assistant::InlineAssist", "ctrl-:": "editor::ToggleInlayHints" } @@ -662,7 +662,7 @@ "alt-ctrl-r": "outline_panel::RevealInFileManager", "space": "outline_panel::Open", "shift-down": "menu::SelectNext", - "shift-up": "menu::SelectPrev", + "shift-up": "menu::SelectPrevious", "alt-enter": "editor::OpenExcerpts", "ctrl-alt-enter": "editor::OpenExcerptsSplit" } @@ -700,7 +700,7 @@ "shift-find": "project_panel::NewSearchInDirectory", "ctrl-shift-f": "project_panel::NewSearchInDirectory", "shift-down": "menu::SelectNext", - "shift-up": "menu::SelectPrev", + "shift-up": "menu::SelectPrevious", "escape": "menu::Cancel" } }, @@ -713,7 +713,7 @@ { "context": "GitPanel && ChangesList", "bindings": { - "up": "menu::SelectPrev", + "up": "menu::SelectPrevious", "down": "menu::SelectNext", "enter": "menu::Confirm", "space": "git::ToggleStaged", @@ -792,7 +792,7 @@ { "context": "FileFinder || (FileFinder > Picker > Editor) || (FileFinder > Picker > menu)", "bindings": { - "ctrl-shift-p": "file_finder::SelectPrev", + "ctrl-shift-p": "file_finder::SelectPrevious", "ctrl-j": "pane::SplitDown", "ctrl-k": "pane::SplitUp", "ctrl-h": "pane::SplitLeft", @@ -802,8 +802,8 @@ { "context": "TabSwitcher", "bindings": { - "ctrl-shift-tab": "menu::SelectPrev", - "ctrl-up": "menu::SelectPrev", + "ctrl-shift-tab": "menu::SelectPrevious", + "ctrl-up": "menu::SelectPrevious", "ctrl-down": "menu::SelectNext", "ctrl-backspace": "tab_switcher::CloseSelectedItem" } diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index 7f538bae11..3003e04ade 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -25,9 +25,9 @@ "tab": "menu::SelectNext", "ctrl-n": "menu::SelectNext", "down": "menu::SelectNext", - "shift-tab": "menu::SelectPrev", - "ctrl-p": "menu::SelectPrev", - "up": "menu::SelectPrev", + "shift-tab": "menu::SelectPrevious", + "ctrl-p": "menu::SelectPrevious", + "up": "menu::SelectPrevious", "enter": "menu::Confirm", "ctrl-enter": "menu::SecondaryConfirm", "cmd-enter": "menu::SecondaryConfirm", @@ -65,7 +65,7 @@ "ctrl-d": "editor::Delete", "delete": "editor::Delete", "tab": "editor::Tab", - "shift-tab": "editor::TabPrev", + "shift-tab": "editor::Backtab", "ctrl-t": "editor::Transpose", "ctrl-k": "editor::KillRingCut", "ctrl-y": "editor::KillRingYank", @@ -219,7 +219,7 @@ "cmd-k c": "assistant::CopyCode", "cmd-shift-e": "project_panel::ToggleFocus", "cmd-g": "search::SelectNextMatch", - "cmd-shift-g": "search::SelectPrevMatch", + "cmd-shift-g": "search::SelectPreviousMatch", "cmd-alt-/": "assistant::ToggleModelSelector", "cmd-k h": "assistant::DeployHistory", "cmd-k l": "assistant::DeployPromptLibrary", @@ -288,7 +288,7 @@ "escape": "buffer_search::Dismiss", "tab": "buffer_search::FocusEditor", "enter": "search::SelectNextMatch", - "shift-enter": "search::SelectPrevMatch", + "shift-enter": "search::SelectPreviousMatch", "alt-enter": "search::SelectAllMatches", "cmd-f": "search::FocusSearch", "cmd-alt-f": "search::ToggleReplace", @@ -370,7 +370,7 @@ "cmd-k cmd-w": ["pane::CloseAllItems", { "close_pinned": false }], "cmd-f": "project_search::ToggleFocus", "cmd-g": "search::SelectNextMatch", - "cmd-shift-g": "search::SelectPrevMatch", + "cmd-shift-g": "search::SelectPreviousMatch", "cmd-shift-h": "search::ToggleReplace", "cmd-alt-l": "search::ToggleSelection", "alt-enter": "search::SelectAllMatches", @@ -410,7 +410,7 @@ "cmd-u": "editor::UndoSelection", "cmd-shift-u": "editor::RedoSelection", "f8": "editor::GoToDiagnostic", - "shift-f8": "editor::GoToPrevDiagnostic", + "shift-f8": "editor::GoToPreviousDiagnostic", "f2": "editor::Rename", "f12": "editor::GoToDefinition", "alt-f12": "editor::GoToDefinitionSplit", @@ -616,8 +616,8 @@ "context": "Editor && (showing_code_actions || showing_completions)", "use_key_equivalents": true, "bindings": { - "up": "editor::ContextMenuPrev", - "ctrl-p": "editor::ContextMenuPrev", + "up": "editor::ContextMenuPrevious", + "ctrl-p": "editor::ContextMenuPrevious", "down": "editor::ContextMenuNext", "ctrl-n": "editor::ContextMenuNext", "pageup": "editor::ContextMenuFirst", @@ -643,7 +643,7 @@ "cmd-alt-enter": "editor::OpenExcerptsSplit", "cmd-shift-e": "pane::RevealInProjectPanel", "cmd-f8": ["editor::GoToHunk", { "center_cursor": true }], - "cmd-shift-f8": ["editor::GoToPrevHunk", { "center_cursor": true }], + "cmd-shift-f8": ["editor::GoToPreviousHunk", { "center_cursor": true }], "ctrl-enter": "assistant::InlineAssist", "ctrl-:": "editor::ToggleInlayHints" } @@ -686,7 +686,7 @@ "alt-cmd-r": "outline_panel::RevealInFileManager", "space": "outline_panel::Open", "shift-down": "menu::SelectNext", - "shift-up": "menu::SelectPrev", + "shift-up": "menu::SelectPrevious", "alt-enter": "editor::OpenExcerpts", "cmd-alt-enter": "editor::OpenExcerptsSplit" } @@ -716,7 +716,7 @@ "cmd-alt-backspace": ["project_panel::Delete", { "skip_prompt": false }], "cmd-shift-f": "project_panel::NewSearchInDirectory", "shift-down": "menu::SelectNext", - "shift-up": "menu::SelectPrev", + "shift-up": "menu::SelectPrevious", "escape": "menu::Cancel" } }, @@ -731,7 +731,7 @@ "context": "GitPanel && ChangesList", "use_key_equivalents": true, "bindings": { - "up": "menu::SelectPrev", + "up": "menu::SelectPrevious", "down": "menu::SelectNext", "cmd-up": "menu::SelectFirst", "cmd-down": "menu::SelectLast", @@ -814,7 +814,7 @@ "context": "FileFinder || (FileFinder > Picker > Editor) || (FileFinder > Picker > menu)", "use_key_equivalents": true, "bindings": { - "cmd-shift-p": "file_finder::SelectPrev", + "cmd-shift-p": "file_finder::SelectPrevious", "cmd-j": "pane::SplitDown", "cmd-k": "pane::SplitUp", "cmd-h": "pane::SplitLeft", @@ -825,8 +825,8 @@ "context": "TabSwitcher", "use_key_equivalents": true, "bindings": { - "ctrl-shift-tab": "menu::SelectPrev", - "ctrl-up": "menu::SelectPrev", + "ctrl-shift-tab": "menu::SelectPrevious", + "ctrl-up": "menu::SelectPrevious", "ctrl-down": "menu::SelectNext", "ctrl-backspace": "tab_switcher::CloseSelectedItem" } diff --git a/assets/keymaps/linux/atom.json b/assets/keymaps/linux/atom.json index 05caf32bcb..d471a54ea5 100644 --- a/assets/keymaps/linux/atom.json +++ b/assets/keymaps/linux/atom.json @@ -39,7 +39,7 @@ "context": "BufferSearchBar", "bindings": { "ctrl-f3": "search::SelectNextMatch", // find-and-replace:find-next-selected - "ctrl-shift-f3": "search::SelectPrevMatch" // find-and-replace:find-previous-selected + "ctrl-shift-f3": "search::SelectPreviousMatch" // find-and-replace:find-previous-selected } }, { diff --git a/assets/keymaps/linux/emacs.json b/assets/keymaps/linux/emacs.json index 4a0f55fd06..e55929a06c 100755 --- a/assets/keymaps/linux/emacs.json +++ b/assets/keymaps/linux/emacs.json @@ -122,7 +122,7 @@ "context": "BufferSearchBar > Editor", "bindings": { "ctrl-s": "search::SelectNextMatch", - "ctrl-r": "search::SelectPrevMatch", + "ctrl-r": "search::SelectPreviousMatch", "ctrl-g": "buffer_search::Dismiss" } }, diff --git a/assets/keymaps/linux/jetbrains.json b/assets/keymaps/linux/jetbrains.json index fe4f8d5e42..2685da7692 100644 --- a/assets/keymaps/linux/jetbrains.json +++ b/assets/keymaps/linux/jetbrains.json @@ -41,9 +41,9 @@ "ctrl-shift-b": "editor::GoToTypeDefinition", "ctrl-alt-shift-b": "editor::GoToTypeDefinitionSplit", "f2": "editor::GoToDiagnostic", - "shift-f2": "editor::GoToPrevDiagnostic", + "shift-f2": "editor::GoToPreviousDiagnostic", "ctrl-alt-shift-down": ["editor::GoToHunk", { "center_cursor": true }], - "ctrl-alt-shift-up": ["editor::GoToPrevHunk", { "center_cursor": true }], + "ctrl-alt-shift-up": ["editor::GoToPreviousHunk", { "center_cursor": true }], "ctrl-alt-z": "git::Restore", "ctrl-home": "editor::MoveToBeginning", "ctrl-end": "editor::MoveToEnd", diff --git a/assets/keymaps/linux/sublime_text.json b/assets/keymaps/linux/sublime_text.json index 37959b2f64..fbd9e2c159 100644 --- a/assets/keymaps/linux/sublime_text.json +++ b/assets/keymaps/linux/sublime_text.json @@ -44,7 +44,7 @@ "shift-f12": "editor::FindAllReferences", "ctrl-shift-f12": "editor::FindAllReferences", "ctrl-.": ["editor::GoToHunk", { "center_cursor": true }], - "ctrl-,": ["editor::GoToPrevHunk", { "center_cursor": true }], + "ctrl-,": ["editor::GoToPreviousHunk", { "center_cursor": true }], "ctrl-k ctrl-u": "editor::ConvertToUpperCase", "ctrl-k ctrl-l": "editor::ConvertToLowerCase", "shift-alt-m": "markdown::OpenPreviewToTheSide", @@ -62,7 +62,7 @@ "context": "Pane", "bindings": { "f4": "search::SelectNextMatch", - "shift-f4": "search::SelectPrevMatch", + "shift-f4": "search::SelectPreviousMatch", "alt-1": ["pane::ActivateItem", 0], "alt-2": ["pane::ActivateItem", 1], "alt-3": ["pane::ActivateItem", 2], diff --git a/assets/keymaps/macos/atom.json b/assets/keymaps/macos/atom.json index 04f07f421f..9ddf353810 100644 --- a/assets/keymaps/macos/atom.json +++ b/assets/keymaps/macos/atom.json @@ -40,7 +40,7 @@ "context": "BufferSearchBar", "bindings": { "cmd-f3": "search::SelectNextMatch", - "cmd-shift-f3": "search::SelectPrevMatch" + "cmd-shift-f3": "search::SelectPreviousMatch" } }, { diff --git a/assets/keymaps/macos/emacs.json b/assets/keymaps/macos/emacs.json index 4a0f55fd06..e55929a06c 100755 --- a/assets/keymaps/macos/emacs.json +++ b/assets/keymaps/macos/emacs.json @@ -122,7 +122,7 @@ "context": "BufferSearchBar > Editor", "bindings": { "ctrl-s": "search::SelectNextMatch", - "ctrl-r": "search::SelectPrevMatch", + "ctrl-r": "search::SelectPreviousMatch", "ctrl-g": "buffer_search::Dismiss" } }, diff --git a/assets/keymaps/macos/jetbrains.json b/assets/keymaps/macos/jetbrains.json index 7871e7e6d8..f7c34d8cf5 100644 --- a/assets/keymaps/macos/jetbrains.json +++ b/assets/keymaps/macos/jetbrains.json @@ -39,9 +39,9 @@ "cmd-shift-b": "editor::GoToTypeDefinition", "cmd-alt-shift-b": "editor::GoToTypeDefinitionSplit", "f2": "editor::GoToDiagnostic", - "shift-f2": "editor::GoToPrevDiagnostic", + "shift-f2": "editor::GoToPreviousDiagnostic", "ctrl-alt-shift-down": ["editor::GoToHunk", { "center_cursor": true }], - "ctrl-alt-shift-up": ["editor::GoToPrevHunk", { "center_cursor": true }], + "ctrl-alt-shift-up": ["editor::GoToPreviousHunk", { "center_cursor": true }], "cmd-home": "editor::MoveToBeginning", "cmd-end": "editor::MoveToEnd", "cmd-shift-home": "editor::SelectToBeginning", @@ -61,7 +61,7 @@ { "context": "BufferSearchBar > Editor", "bindings": { - "shift-enter": "search::SelectPrevMatch" + "shift-enter": "search::SelectPreviousMatch" } }, { diff --git a/assets/keymaps/macos/sublime_text.json b/assets/keymaps/macos/sublime_text.json index 656e6d634c..7499bbcebd 100644 --- a/assets/keymaps/macos/sublime_text.json +++ b/assets/keymaps/macos/sublime_text.json @@ -45,7 +45,7 @@ "ctrl-alt-cmd-down": "editor::GoToDefinitionSplit", "alt-shift-cmd-down": "editor::FindAllReferences", "ctrl-.": ["editor::GoToHunk", { "center_cursor": true }], - "ctrl-,": ["editor::GoToPrevHunk", { "center_cursor": true }], + "ctrl-,": ["editor::GoToPreviousHunk", { "center_cursor": true }], "cmd-k cmd-u": "editor::ConvertToUpperCase", "cmd-k cmd-l": "editor::ConvertToLowerCase", "cmd-shift-j": "editor::JoinLines", @@ -64,7 +64,7 @@ "context": "Pane", "bindings": { "f4": "search::SelectNextMatch", - "shift-f4": "search::SelectPrevMatch", + "shift-f4": "search::SelectPreviousMatch", "cmd-1": ["pane::ActivateItem", 0], "cmd-2": ["pane::ActivateItem", 1], "cmd-3": ["pane::ActivateItem", 2], diff --git a/assets/keymaps/macos/textmate.json b/assets/keymaps/macos/textmate.json index 90d3510abc..dccb675f6c 100644 --- a/assets/keymaps/macos/textmate.json +++ b/assets/keymaps/macos/textmate.json @@ -47,7 +47,7 @@ "context": "BufferSearchBar", "bindings": { "ctrl-s": "search::SelectNextMatch", - "ctrl-shift-s": "search::SelectPrevMatch" + "ctrl-shift-s": "search::SelectPreviousMatch" } }, { diff --git a/assets/keymaps/storybook.json b/assets/keymaps/storybook.json index a59e084a88..9b92fbe1a3 100644 --- a/assets/keymaps/storybook.json +++ b/assets/keymaps/storybook.json @@ -13,9 +13,9 @@ "tab": "menu::SelectNext", "ctrl-n": "menu::SelectNext", "down": "menu::SelectNext", - "shift-tab": "menu::SelectPrev", - "ctrl-p": "menu::SelectPrev", - "up": "menu::SelectPrev", + "shift-tab": "menu::SelectPrevious", + "ctrl-p": "menu::SelectPrevious", + "up": "menu::SelectPrevious", "enter": "menu::Confirm", "ctrl-enter": "menu::SecondaryConfirm", "cmd-enter": "menu::SecondaryConfirm", diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 62367044a6..00d678cc0b 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -138,7 +138,7 @@ "g ^": ["vim::FirstNonWhitespace", { "display_lines": true }], "g v": "vim::RestoreVisualSelection", "g ]": "editor::GoToDiagnostic", - "g [": "editor::GoToPrevDiagnostic", + "g [": "editor::GoToPreviousDiagnostic", "g i": "vim::InsertAtPrevious", "g ,": "vim::ChangeListNewer", "g ;": "vim::ChangeListOlder", @@ -237,9 +237,9 @@ "[ x": "vim::SelectLargerSyntaxNode", "] x": "vim::SelectSmallerSyntaxNode", "] d": "editor::GoToDiagnostic", - "[ d": "editor::GoToPrevDiagnostic", + "[ d": "editor::GoToPreviousDiagnostic", "] c": ["editor::GoToHunk", { "center_cursor": true }], - "[ c": ["editor::GoToPrevHunk", { "center_cursor": true }], + "[ c": ["editor::GoToPreviousHunk", { "center_cursor": true }], "g c": "vim::PushToggleComments" } }, @@ -664,7 +664,7 @@ "escape": "project_panel::ToggleFocus", "h": "project_panel::CollapseSelectedEntry", "j": "menu::SelectNext", - "k": "menu::SelectPrev", + "k": "menu::SelectPrevious", "l": "project_panel::ExpandSelectedEntry", "o": "project_panel::OpenPermanent", "shift-d": "project_panel::Delete", @@ -690,7 +690,7 @@ "context": "OutlinePanel && not_editing", "bindings": { "j": "menu::SelectNext", - "k": "menu::SelectPrev", + "k": "menu::SelectPrevious", "shift-g": "menu::SelectLast", "g g": "menu::SelectFirst" } @@ -699,7 +699,7 @@ "context": "GitPanel && ChangesList", "use_key_equivalents": true, "bindings": { - "k": "menu::SelectPrev", + "k": "menu::SelectPrevious", "j": "menu::SelectNext", "g g": "menu::SelectFirst", "shift-g": "menu::SelectLast", diff --git a/crates/assistant2/src/thread_history.rs b/crates/assistant2/src/thread_history.rs index 80cb8dd44b..e44a5ecb27 100644 --- a/crates/assistant2/src/thread_history.rs +++ b/crates/assistant2/src/thread_history.rs @@ -33,9 +33,9 @@ impl ThreadHistory { } } - pub fn select_prev( + pub fn select_previous( &mut self, - _: &menu::SelectPrev, + _: &menu::SelectPrevious, window: &mut Window, cx: &mut Context, ) { @@ -166,7 +166,7 @@ impl Render for ThreadHistory { .overflow_y_scroll() .size_full() .p_1() - .on_action(cx.listener(Self::select_prev)) + .on_action(cx.listener(Self::select_previous)) .on_action(cx.listener(Self::select_next)) .on_action(cx.listener(Self::select_first)) .on_action(cx.listener(Self::select_last)) diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index 0e9da50f31..cbbb6e0e80 100644 --- a/crates/collab_ui/src/collab_panel.rs +++ b/crates/collab_ui/src/collab_panel.rs @@ -17,7 +17,7 @@ use gpui::{ ListState, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, SharedString, Styled, Subscription, Task, TextStyle, WeakEntity, Window, }; -use menu::{Cancel, Confirm, SecondaryConfirm, SelectNext, SelectPrev}; +use menu::{Cancel, Confirm, SecondaryConfirm, SelectNext, SelectPrevious}; use project::{Fs, Project}; use rpc::{ proto::{self, ChannelVisibility, PeerId}, @@ -1430,7 +1430,7 @@ impl CollabPanel { cx.notify(); } - fn select_prev(&mut self, _: &SelectPrev, _: &mut Window, cx: &mut Context) { + fn select_previous(&mut self, _: &SelectPrevious, _: &mut Window, cx: &mut Context) { let ix = self.selection.take().unwrap_or(0); if ix > 0 { self.selection = Some(ix - 1); @@ -2878,7 +2878,7 @@ impl Render for CollabPanel { .key_context("CollabPanel") .on_action(cx.listener(CollabPanel::cancel)) .on_action(cx.listener(CollabPanel::select_next)) - .on_action(cx.listener(CollabPanel::select_prev)) + .on_action(cx.listener(CollabPanel::select_previous)) .on_action(cx.listener(CollabPanel::confirm)) .on_action(cx.listener(CollabPanel::insert_space)) .on_action(cx.listener(CollabPanel::remove_selected_channel)) diff --git a/crates/editor/src/actions.rs b/crates/editor/src/actions.rs index db84a1916c..6d7c39b66e 100644 --- a/crates/editor/src/actions.rs +++ b/crates/editor/src/actions.rs @@ -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, diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index a92265010e..2d51cc47d7 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -7192,7 +7192,7 @@ impl Editor { }); } - pub fn tab_prev(&mut self, _: &TabPrev, window: &mut Window, cx: &mut Context) { + pub fn backtab(&mut self, _: &Backtab, window: &mut Window, cx: &mut Context) { 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, ) { @@ -11263,7 +11263,7 @@ impl Editor { fn go_to_prev_diagnostic( &mut self, - _: &GoToPrevDiagnostic, + _: &GoToPreviousDiagnostic, window: &mut Window, cx: &mut Context, ) { @@ -11476,7 +11476,7 @@ impl Editor { fn go_to_prev_hunk( &mut self, - action: &GoToPrevHunk, + action: &GoToPreviousHunk, window: &mut Window, cx: &mut Context, ) { diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index 0efe03ead0..cfa5699db6 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -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. diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 0e256d5ace..ef8de30373 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -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, diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index eab204f115..0d0b965bc5 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -44,7 +44,7 @@ use workspace::{ Workspace, }; -actions!(file_finder, [SelectPrev, ToggleMenu]); +actions!(file_finder, [SelectPrevious, ToggleMenu]); impl ModalView for FileFinder { fn on_before_dismiss( @@ -199,9 +199,14 @@ impl FileFinder { } } - fn handle_select_prev(&mut self, _: &SelectPrev, window: &mut Window, cx: &mut Context) { + fn handle_select_prev( + &mut self, + _: &SelectPrevious, + window: &mut Window, + cx: &mut Context, + ) { self.init_modifiers = Some(window.modifiers()); - window.dispatch_action(Box::new(menu::SelectPrev), cx); + window.dispatch_action(Box::new(menu::SelectPrevious), cx); } fn handle_toggle_menu(&mut self, _: &ToggleMenu, window: &mut Window, cx: &mut Context) { diff --git a/crates/file_finder/src/file_finder_tests.rs b/crates/file_finder/src/file_finder_tests.rs index 1dd7815956..13c226ded2 100644 --- a/crates/file_finder/src/file_finder_tests.rs +++ b/crates/file_finder/src/file_finder_tests.rs @@ -3,7 +3,7 @@ use std::{assert_eq, future::IntoFuture, path::Path, time::Duration}; use super::*; use editor::Editor; use gpui::{Entity, TestAppContext, VisualTestContext}; -use menu::{Confirm, SelectNext, SelectPrev}; +use menu::{Confirm, SelectNext, SelectPrevious}; use project::{RemoveOptions, FS_WATCH_LATENCY}; use serde_json::json; use util::path; @@ -2059,7 +2059,7 @@ async fn test_switches_between_release_norelease_modes_on_backward_nav( // Switch to navigating with other shortcuts // Don't open file on modifiers release cx.simulate_modifiers_change(Modifiers::control()); - cx.dispatch_action(menu::SelectPrev); + cx.dispatch_action(menu::SelectPrevious); cx.simulate_modifiers_change(Modifiers::none()); picker.update(cx, |finder, _| { assert_eq!(finder.delegate.matches.len(), 3); @@ -2071,7 +2071,7 @@ async fn test_switches_between_release_norelease_modes_on_backward_nav( // Back to navigation with initial shortcut // Open file on modifiers release cx.simulate_modifiers_change(Modifiers::secondary_key()); - cx.dispatch_action(SelectPrev); // <-- File Finder's SelectPrev, not menu's + cx.dispatch_action(SelectPrevious); // <-- File Finder's SelectPrevious, not menu's cx.simulate_modifiers_change(Modifiers::none()); cx.read(|cx| { let active_editor = workspace.read(cx).active_item_as::(cx).unwrap(); diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 6fe12b3c38..b9eda964d6 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -21,7 +21,7 @@ use git::{RestoreTrackedFiles, StageAll, TrashUntrackedFiles, UnstageAll}; use gpui::*; use itertools::Itertools; use language::{Buffer, File}; -use menu::{Confirm, SecondaryConfirm, SelectFirst, SelectLast, SelectNext, SelectPrev}; +use menu::{Confirm, SecondaryConfirm, SelectFirst, SelectLast, SelectNext, SelectPrevious}; use multi_buffer::ExcerptInfo; use panel::{ panel_editor_container, panel_editor_style, panel_filled_button, panel_icon_button, PanelHeader, @@ -581,7 +581,12 @@ impl GitPanel { } } - fn select_prev(&mut self, _: &SelectPrev, _window: &mut Window, cx: &mut Context) { + fn select_previous( + &mut self, + _: &SelectPrevious, + _window: &mut Window, + cx: &mut Context, + ) { let item_count = self.entries.len(); if item_count == 0 { return; @@ -2596,7 +2601,7 @@ impl Render for GitPanel { }) .on_action(cx.listener(Self::select_first)) .on_action(cx.listener(Self::select_next)) - .on_action(cx.listener(Self::select_prev)) + .on_action(cx.listener(Self::select_previous)) .on_action(cx.listener(Self::select_last)) .on_action(cx.listener(Self::close_panel)) .on_action(cx.listener(Self::open_diff)) diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index e1a10a9168..e71490edce 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -3,7 +3,7 @@ use anyhow::Result; use buffer_diff::{BufferDiff, DiffHunkSecondaryStatus}; use collections::HashSet; use editor::{ - actions::{GoToHunk, GoToPrevHunk}, + actions::{GoToHunk, GoToPreviousHunk}, scroll::Autoscroll, Editor, EditorEvent, ToPoint, }; @@ -869,7 +869,7 @@ impl Render for ProjectDiffToolbar { .shape(ui::IconButtonShape::Square) .tooltip(Tooltip::for_action_title_in( "Go to previous hunk", - &GoToPrevHunk { + &GoToPreviousHunk { center_cursor: false, }, &focus_handle, @@ -877,7 +877,7 @@ impl Render for ProjectDiffToolbar { .disabled(!button_states.prev_next) .on_click(cx.listener(|this, _, window, cx| { this.dispatch_action( - &GoToPrevHunk { + &GoToPreviousHunk { center_cursor: true, }, window, diff --git a/crates/menu/src/menu.rs b/crates/menu/src/menu.rs index 3c5dc2521f..7c8cc7abb0 100644 --- a/crates/menu/src/menu.rs +++ b/crates/menu/src/menu.rs @@ -15,7 +15,7 @@ actions!( Cancel, Confirm, SecondaryConfirm, - SelectPrev, + SelectPrevious, SelectNext, SelectFirst, SelectLast, diff --git a/crates/migrator/src/migrator.rs b/crates/migrator/src/migrator.rs index d3716cf01b..8ced1b206c 100644 --- a/crates/migrator/src/migrator.rs +++ b/crates/migrator/src/migrator.rs @@ -92,6 +92,10 @@ const KEYMAP_MIGRATION_TRANSFORMATION_PATTERNS: MigrationPatterns = &[ ), (ACTION_STRING_PATTERN, rename_string_action), (CONTEXT_PREDICATE_PATTERN, rename_context_key), + ( + ACTION_STRING_OF_ARRAY_PATTERN, + replace_first_string_of_array, + ), ]; static KEYMAP_MIGRATION_TRANSFORMATION_QUERY: LazyLock = LazyLock::new(|| { @@ -265,6 +269,51 @@ static TRANSFORM_ARRAY: LazyLock> = LazyLock::new(|| ]) }); +const ACTION_STRING_OF_ARRAY_PATTERN: &str = r#"(document + (array + (object + (pair + key: (string (string_content) @name) + value: ( + (object + (pair + key: (string) + value: ((array + . (string (string_content) @action_name) + ) + ) + ) + ) + ) + ) + ) + ) + (#eq? @name "bindings") +)"#; + +// ["editor::GoToPrevHunk", { "center_cursor": true }] -> ["editor::GoToPreviousHunk", { "center_cursor": true }] +fn replace_first_string_of_array( + contents: &str, + mat: &QueryMatch, + query: &Query, +) -> Option<(Range, String)> { + let action_name_ix = query.capture_index_for_name("action_name")?; + let action_name = contents.get( + mat.nodes_for_capture_index(action_name_ix) + .next()? + .byte_range(), + )?; + let replacement = STRING_OF_ARRAY_REPLACE.get(action_name)?; + let range_to_replace = mat + .nodes_for_capture_index(action_name_ix) + .next()? + .byte_range(); + Some((range_to_replace, replacement.to_string())) +} + +static STRING_OF_ARRAY_REPLACE: LazyLock> = + LazyLock::new(|| HashMap::from_iter([("editor::GoToPrevHunk", "editor::GoToPreviousHunk")])); + const ACTION_ARGUMENT_OBJECT_PATTERN: &str = r#"(document (array (object @@ -424,20 +473,29 @@ static STRING_REPLACE: LazyLock> = LazyLock::new(|| { "editor::ToggleInlineCompletions", "editor::ToggleEditPrediction", ), + ( + "editor::GoToPrevDiagnostic", + "editor::GoToPreviousDiagnostic", + ), + ("editor::ContextMenuPrev", "editor::ContextMenuPrevious"), + ("search::SelectPrevMatch", "search::SelectPreviousMatch"), + ("file_finder::SelectPrev", "file_finder::SelectPrevious"), + ("menu::SelectPrev", "menu::SelectPrevious"), + ("editor::TabPrev", "editor::Backtab"), ]) }); -const CONTEXT_PREDICATE_PATTERN: &str = r#" -(array - (object - (pair - key: (string (string_content) @name) - value: (string (string_content) @context_predicate) +const CONTEXT_PREDICATE_PATTERN: &str = r#"(document + (array + (object + (pair + key: (string (string_content) @name) + value: (string (string_content) @context_predicate) + ) ) ) -) -(#eq? @name "context") -"#; + (#eq? @name "context") +)"#; fn rename_context_key( contents: &str, @@ -940,6 +998,36 @@ mod tests { ) } + #[test] + fn test_string_of_array_replace() { + assert_migrate_keymap( + r#" + [ + { + "bindings": { + "ctrl-p": ["editor::GoToPrevHunk", { "center_cursor": true }], + "ctrl-q": ["editor::GoToPrevHunk"], + "ctrl-q": "editor::GoToPrevHunk", // should remain same + } + } + ] + "#, + Some( + r#" + [ + { + "bindings": { + "ctrl-p": ["editor::GoToPreviousHunk", { "center_cursor": true }], + "ctrl-q": ["editor::GoToPreviousHunk"], + "ctrl-q": "editor::GoToPrevHunk", // should remain same + } + } + ] + "#, + ), + ) + } + #[test] fn test_action_argument_snake_case() { // First performs transformations, then replacements diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index 49333396c1..fa3c8e822d 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -448,7 +448,7 @@ mod tests { ); assert_single_caret_at_row(&editor, 0, cx); - cx.dispatch_action(menu::SelectPrev); + cx.dispatch_action(menu::SelectPrevious); ensure_outline_view_contents(&outline_view, cx); assert_eq!( highlighted_display_rows(&editor, cx), diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index eaa05b68ba..58cf5db5ed 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -37,7 +37,7 @@ use gpui::{ }; use itertools::Itertools; use language::{BufferId, BufferSnapshot, OffsetRangeExt, OutlineItem}; -use menu::{Cancel, SelectFirst, SelectLast, SelectNext, SelectPrev}; +use menu::{Cancel, SelectFirst, SelectLast, SelectNext, SelectPrevious}; use outline_panel_settings::{OutlinePanelDockPosition, OutlinePanelSettings, ShowIndentGuides}; use project::{File, Fs, Project, ProjectItem}; @@ -1148,7 +1148,7 @@ impl OutlinePanel { } } - fn select_prev(&mut self, _: &SelectPrev, window: &mut Window, cx: &mut Context) { + fn select_previous(&mut self, _: &SelectPrevious, window: &mut Window, cx: &mut Context) { if let Some(entry_to_select) = self.selected_entry().and_then(|selected_entry| { self.cached_entries .iter() @@ -4911,7 +4911,7 @@ impl Render for OutlinePanel { .on_action(cx.listener(Self::open)) .on_action(cx.listener(Self::cancel)) .on_action(cx.listener(Self::select_next)) - .on_action(cx.listener(Self::select_prev)) + .on_action(cx.listener(Self::select_previous)) .on_action(cx.listener(Self::select_first)) .on_action(cx.listener(Self::select_last)) .on_action(cx.listener(Self::select_parent)) @@ -5851,7 +5851,7 @@ mod tests { }); outline_panel.update_in(cx, |outline_panel, window, cx| { - outline_panel.select_prev(&SelectPrev, window, cx); + outline_panel.select_previous(&SelectPrevious, window, cx); outline_panel.open(&Open, window, cx); }); cx.executor() @@ -6138,7 +6138,7 @@ outline: struct OutlineEntryExcerpt <==== selected cx.update(|window, cx| { outline_panel.update(cx, |outline_panel, cx| { - outline_panel.select_prev(&SelectPrev, window, cx); + outline_panel.select_previous(&SelectPrevious, window, cx); }); }); cx.executor() @@ -6165,7 +6165,7 @@ outline: struct OutlineEntryExcerpt cx.update(|window, cx| { outline_panel.update(cx, |outline_panel, cx| { - outline_panel.select_prev(&SelectPrev, window, cx); + outline_panel.select_previous(&SelectPrevious, window, cx); }); }); cx.executor() @@ -6192,7 +6192,7 @@ outline: struct OutlineEntryExcerpt cx.update(|window, cx| { outline_panel.update(cx, |outline_panel, cx| { - outline_panel.select_prev(&SelectPrev, window, cx); + outline_panel.select_previous(&SelectPrevious, window, cx); }); }); cx.executor() @@ -6219,7 +6219,7 @@ outline: struct OutlineEntryExcerpt cx.update(|window, cx| { outline_panel.update(cx, |outline_panel, cx| { - outline_panel.select_prev(&SelectPrev, window, cx); + outline_panel.select_previous(&SelectPrevious, window, cx); }); }); cx.executor() @@ -6246,7 +6246,7 @@ outline: struct OutlineEntryExcerpt <==== selected cx.update(|window, cx| { outline_panel.update(cx, |outline_panel, cx| { - outline_panel.select_prev(&SelectPrev, window, cx); + outline_panel.select_previous(&SelectPrevious, window, cx); }); }); cx.executor() diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 0a4bf14c56..469513a2ca 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -391,7 +391,12 @@ impl Picker { } } - fn select_prev(&mut self, _: &menu::SelectPrev, window: &mut Window, cx: &mut Context) { + fn select_previous( + &mut self, + _: &menu::SelectPrevious, + window: &mut Window, + cx: &mut Context, + ) { let count = self.delegate.match_count(); if count > 0 { let index = self.delegate.selected_index(); @@ -786,7 +791,7 @@ impl Render for Picker { // We should revisit how the `Picker` is styled to make it more composable. .when(self.is_modal, |this| this.elevation_3(cx)) .on_action(cx.listener(Self::select_next)) - .on_action(cx.listener(Self::select_prev)) + .on_action(cx.listener(Self::select_previous)) .on_action(cx.listener(Self::select_first)) .on_action(cx.listener(Self::select_last)) .on_action(cx.listener(Self::cancel)) diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 341587ab56..bdcf4281f1 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -26,7 +26,7 @@ use gpui::{ }; use indexmap::IndexMap; use language::DiagnosticSeverity; -use menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrev}; +use menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrevious}; use project::{ relativize_path, Entry, EntryKind, Fs, Project, ProjectEntryId, ProjectPath, Worktree, WorktreeId, @@ -1028,7 +1028,7 @@ impl ProjectPanel { }); } - fn select_prev(&mut self, _: &SelectPrev, window: &mut Window, cx: &mut Context) { + fn select_previous(&mut self, _: &SelectPrevious, window: &mut Window, cx: &mut Context) { if let Some(edit_state) = &self.edit_state { if edit_state.processing_filename.is_none() { self.filename_editor.update(cx, |editor, cx| { @@ -4434,7 +4434,7 @@ impl Render for ProjectPanel { })) .key_context(self.dispatch_context(window, cx)) .on_action(cx.listener(Self::select_next)) - .on_action(cx.listener(Self::select_prev)) + .on_action(cx.listener(Self::select_previous)) .on_action(cx.listener(Self::select_first)) .on_action(cx.listener(Self::select_last)) .on_action(cx.listener(Self::select_parent)) @@ -7522,7 +7522,7 @@ mod tests { ); cx.update(|window, cx| { panel.update(cx, |this, cx| { - this.select_prev(&Default::default(), window, cx); + this.select_previous(&Default::default(), window, cx); }) }); assert_eq!( @@ -7579,7 +7579,7 @@ mod tests { // ESC clears out all marks cx.update(|window, cx| { panel.update(cx, |this, cx| { - this.select_prev(&SelectPrev, window, cx); + this.select_previous(&SelectPrevious, window, cx); this.select_next(&SelectNext, window, cx); }) }); @@ -7597,8 +7597,8 @@ mod tests { cx.update(|window, cx| { panel.update(cx, |this, cx| { this.cut(&Cut, window, cx); - this.select_prev(&SelectPrev, window, cx); - this.select_prev(&SelectPrev, window, cx); + this.select_previous(&SelectPrevious, window, cx); + this.select_previous(&SelectPrevious, window, cx); this.paste(&Paste, window, cx); // this.expand_selected_entry(&ExpandSelectedEntry, cx); diff --git a/crates/repl/src/notebook/notebook_ui.rs b/crates/repl/src/notebook/notebook_ui.rs index 9b40b973d8..eaa7cb97f1 100644 --- a/crates/repl/src/notebook/notebook_ui.rs +++ b/crates/repl/src/notebook/notebook_ui.rs @@ -245,7 +245,7 @@ impl NotebookEditor { pub fn select_previous( &mut self, - _: &menu::SelectPrev, + _: &menu::SelectPrevious, window: &mut Window, cx: &mut Context, ) { diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 748662abf3..97a2e31ac1 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -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, ) { @@ -1333,7 +1335,7 @@ impl BufferSearchBar { cx.stop_propagation(); } - fn tab_prev(&mut self, _: &TabPrev, window: &mut Window, cx: &mut Context) { + fn backtab(&mut self, _: &Backtab, window: &mut Window, cx: &mut Context) { // 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| { diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 5f54507007..1ff04a8153 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -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, ) { @@ -1697,7 +1697,7 @@ impl ProjectSearchBar { fn select_prev_match( &mut self, - _: &SelectPrevMatch, + _: &SelectPreviousMatch, window: &mut Window, cx: &mut Context, ) { @@ -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))) diff --git a/crates/search/src/search.rs b/crates/search/src/search.rs index 28b61b5605..4bfea34c78 100644 --- a/crates/search/src/search.rs +++ b/crates/search/src/search.rs @@ -30,7 +30,7 @@ actions!( ToggleReplace, ToggleSelection, SelectNextMatch, - SelectPrevMatch, + SelectPreviousMatch, SelectAllMatches, NextHistoryQuery, PreviousHistoryQuery, diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index 10980bba42..7b953b8bae 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -620,7 +620,7 @@ mod tests { // Standard macOS bindings { \"bindings\": { - \"up\": \"menu::SelectPrev\", + \"up\": \"menu::SelectPrevious\", }, }, ] diff --git a/crates/storybook/src/stories/picker.rs b/crates/storybook/src/stories/picker.rs index 6a49042f90..a946bfed7c 100644 --- a/crates/storybook/src/stories/picker.rs +++ b/crates/storybook/src/stories/picker.rs @@ -114,10 +114,10 @@ impl PickerStory { pub fn new(window: &mut Window, cx: &mut App) -> Entity { cx.new(|cx| { cx.bind_keys([ - KeyBinding::new("up", menu::SelectPrev, Some("picker")), + KeyBinding::new("up", menu::SelectPrevious, Some("picker")), KeyBinding::new("pageup", menu::SelectFirst, Some("picker")), KeyBinding::new("shift-pageup", menu::SelectFirst, Some("picker")), - KeyBinding::new("ctrl-p", menu::SelectPrev, Some("picker")), + KeyBinding::new("ctrl-p", menu::SelectPrevious, Some("picker")), KeyBinding::new("down", menu::SelectNext, Some("picker")), KeyBinding::new("pagedown", menu::SelectLast, Some("picker")), KeyBinding::new("shift-pagedown", menu::SelectFirst, Some("picker")), diff --git a/crates/tab_switcher/src/tab_switcher_tests.rs b/crates/tab_switcher/src/tab_switcher_tests.rs index 35c53f4dbd..a1b53faf58 100644 --- a/crates/tab_switcher/src/tab_switcher_tests.rs +++ b/crates/tab_switcher/src/tab_switcher_tests.rs @@ -1,7 +1,7 @@ use super::*; use editor::Editor; use gpui::{TestAppContext, VisualTestContext}; -use menu::SelectPrev; +use menu::SelectPrevious; use project::{Project, ProjectPath}; use serde_json::json; use std::path::Path; @@ -64,7 +64,7 @@ async fn test_open_with_prev_tab_selected_and_cycle_on_toggle_action( assert_match_selection(tab_switcher, 3, tab_1.boxed_clone()); }); - cx.dispatch_action(SelectPrev); + cx.dispatch_action(SelectPrevious); tab_switcher.update(cx, |tab_switcher, _| { assert_eq!(tab_switcher.delegate.matches.len(), 4); assert_match_at_position(tab_switcher, 0, tab_4.boxed_clone()); diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs index 3d003200c1..2179535627 100644 --- a/crates/ui/src/components/context_menu.rs +++ b/crates/ui/src/components/context_menu.rs @@ -6,7 +6,7 @@ use gpui::{ px, Action, AnyElement, App, AppContext as _, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, Render, Subscription, }; -use menu::{SelectFirst, SelectLast, SelectNext, SelectPrev}; +use menu::{SelectFirst, SelectLast, SelectNext, SelectPrevious}; use settings::Settings; use std::{rc::Rc, time::Duration}; use theme::ThemeSettings; @@ -410,7 +410,12 @@ impl ContextMenu { } } - pub fn select_prev(&mut self, _: &SelectPrev, window: &mut Window, cx: &mut Context) { + pub fn select_previous( + &mut self, + _: &SelectPrevious, + window: &mut Window, + cx: &mut Context, + ) { if let Some(ix) = self.selected_index { if ix == 0 { self.handle_select_last(&SelectLast, window, cx); @@ -555,7 +560,7 @@ impl Render for ContextMenu { .on_action(cx.listener(ContextMenu::select_first)) .on_action(cx.listener(ContextMenu::handle_select_last)) .on_action(cx.listener(ContextMenu::select_next)) - .on_action(cx.listener(ContextMenu::select_prev)) + .on_action(cx.listener(ContextMenu::select_previous)) .on_action(cx.listener(ContextMenu::confirm)) .on_action(cx.listener(ContextMenu::cancel)) .when(!self.delayed, |mut el| { diff --git a/crates/ui/src/components/navigable.rs b/crates/ui/src/components/navigable.rs index a9b7fa9c5d..52d7128b7a 100644 --- a/crates/ui/src/components/navigable.rs +++ b/crates/ui/src/components/navigable.rs @@ -44,7 +44,7 @@ impl Navigable { /// Add a new entry that can be navigated to via keyboard. /// /// The order of calls to [Navigable::entry] determines the order of traversal of - /// elements via successive uses of `menu:::SelectNext/SelectPrev` + /// elements via successive uses of `menu:::SelectNext/SelectPrevious` pub fn entry(mut self, child: NavigableEntry) -> Self { self.selectable_children.push(child); self @@ -83,7 +83,7 @@ impl RenderOnce for Navigable { }) .on_action({ let children = self.selectable_children; - move |_: &menu::SelectPrev, window, cx| { + move |_: &menu::SelectPrevious, window, cx| { let target = Self::find_focused(&children, window, cx) .and_then(|index| index.checked_sub(1)) .or(children.len().checked_sub(1)); diff --git a/crates/vim/src/command.rs b/crates/vim/src/command.rs index 12b7211b8e..b32520664e 100644 --- a/crates/vim/src/command.rs +++ b/crates/vim/src/command.rs @@ -827,10 +827,12 @@ fn generate_commands(_: &App) -> Vec { VimCommand::new(("cc", ""), editor::actions::Hover), VimCommand::new(("ll", ""), editor::actions::Hover), VimCommand::new(("cn", "ext"), editor::actions::GoToDiagnostic).range(wrap_count), - VimCommand::new(("cp", "revious"), editor::actions::GoToPrevDiagnostic).range(wrap_count), - VimCommand::new(("cN", "ext"), editor::actions::GoToPrevDiagnostic).range(wrap_count), - VimCommand::new(("lp", "revious"), editor::actions::GoToPrevDiagnostic).range(wrap_count), - VimCommand::new(("lN", "ext"), editor::actions::GoToPrevDiagnostic).range(wrap_count), + VimCommand::new(("cp", "revious"), editor::actions::GoToPreviousDiagnostic) + .range(wrap_count), + VimCommand::new(("cN", "ext"), editor::actions::GoToPreviousDiagnostic).range(wrap_count), + VimCommand::new(("lp", "revious"), editor::actions::GoToPreviousDiagnostic) + .range(wrap_count), + VimCommand::new(("lN", "ext"), editor::actions::GoToPreviousDiagnostic).range(wrap_count), VimCommand::new(("j", "oin"), JoinLines).range(select_range), VimCommand::new(("fo", "ld"), editor::actions::FoldSelectedRanges).range(act_on_range), VimCommand::new(("foldo", "pen"), editor::actions::UnfoldLines) diff --git a/crates/zed/src/zed/app_menus.rs b/crates/zed/src/zed/app_menus.rs index ec5dc29ee8..4d72068f90 100644 --- a/crates/zed/src/zed/app_menus.rs +++ b/crates/zed/src/zed/app_menus.rs @@ -189,7 +189,7 @@ pub fn app_menus() -> Vec { MenuItem::action("Find All References", editor::actions::FindAllReferences), MenuItem::separator(), MenuItem::action("Next Problem", editor::actions::GoToDiagnostic), - MenuItem::action("Previous Problem", editor::actions::GoToPrevDiagnostic), + MenuItem::action("Previous Problem", editor::actions::GoToPreviousDiagnostic), ], }, Menu { diff --git a/crates/zed/src/zed/linux_prompts.rs b/crates/zed/src/zed/linux_prompts.rs index e6c2bf62b1..20cd14c444 100644 --- a/crates/zed/src/zed/linux_prompts.rs +++ b/crates/zed/src/zed/linux_prompts.rs @@ -102,7 +102,12 @@ impl FallbackPromptRenderer { cx.notify(); } - fn select_prev(&mut self, _: &menu::SelectPrev, _window: &mut Window, cx: &mut Context) { + fn select_previous( + &mut self, + _: &menu::SelectPrevious, + _window: &mut Window, + cx: &mut Context, + ) { self.active_action_id = (self.active_action_id + 1) % self.actions.len(); cx.notify(); } @@ -119,7 +124,7 @@ impl Render for FallbackPromptRenderer { .on_action(cx.listener(Self::confirm)) .on_action(cx.listener(Self::cancel)) .on_action(cx.listener(Self::select_next)) - .on_action(cx.listener(Self::select_prev)) + .on_action(cx.listener(Self::select_previous)) .on_action(cx.listener(Self::select_first)) .on_action(cx.listener(Self::select_last)) .elevation_3(cx) diff --git a/crates/zed/src/zed/quick_action_bar.rs b/crates/zed/src/zed/quick_action_bar.rs index 6f5ed44918..1b6a11abc2 100644 --- a/crates/zed/src/zed/quick_action_bar.rs +++ b/crates/zed/src/zed/quick_action_bar.rs @@ -5,8 +5,8 @@ use assistant::AssistantPanel; use assistant_settings::AssistantSettings; use editor::actions::{ AddSelectionAbove, AddSelectionBelow, DuplicateLineDown, GoToDiagnostic, GoToHunk, - GoToPrevDiagnostic, GoToPrevHunk, MoveLineDown, MoveLineUp, SelectAll, SelectLargerSyntaxNode, - SelectNext, SelectSmallerSyntaxNode, ToggleGoToLine, + GoToPreviousDiagnostic, GoToPreviousHunk, MoveLineDown, MoveLineUp, SelectAll, + SelectLargerSyntaxNode, SelectNext, SelectSmallerSyntaxNode, ToggleGoToLine, }; use editor::{Editor, EditorSettings}; use gpui::{ @@ -180,7 +180,7 @@ impl Render for QuickActionBar { .action("Go to Line/Column", Box::new(ToggleGoToLine)) .separator() .action("Next Problem", Box::new(GoToDiagnostic)) - .action("Previous Problem", Box::new(GoToPrevDiagnostic)) + .action("Previous Problem", Box::new(GoToPreviousDiagnostic)) .separator() .action( "Next Hunk", @@ -190,7 +190,7 @@ impl Render for QuickActionBar { ) .action( "Previous Hunk", - Box::new(GoToPrevHunk { + Box::new(GoToPreviousHunk { center_cursor: true, }), ) diff --git a/crates/zeta/src/rate_completion_modal.rs b/crates/zeta/src/rate_completion_modal.rs index 28c1dad1f1..9e4ad6c79b 100644 --- a/crates/zeta/src/rate_completion_modal.rs +++ b/crates/zeta/src/rate_completion_modal.rs @@ -82,7 +82,12 @@ impl RateCompletionModal { cx.notify(); } - fn select_prev(&mut self, _: &menu::SelectPrev, _: &mut Window, cx: &mut Context) { + fn select_previous( + &mut self, + _: &menu::SelectPrevious, + _: &mut Window, + cx: &mut Context, + ) { self.selected_index = self.selected_index.saturating_sub(1); cx.notify(); } @@ -529,7 +534,7 @@ impl Render for RateCompletionModal { .track_focus(&self.focus_handle) .on_action(cx.listener(Self::dismiss)) .on_action(cx.listener(Self::confirm)) - .on_action(cx.listener(Self::select_prev)) + .on_action(cx.listener(Self::select_previous)) .on_action(cx.listener(Self::select_prev_edit)) .on_action(cx.listener(Self::select_next)) .on_action(cx.listener(Self::select_next_edit))