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
co-authored by Joseph T. Lyons
parent 61d584db45
commit 593f3dc1d5
43 changed files with 320 additions and 198 deletions
+20 -20
View File
@@ -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"
}
+17 -17
View File
@@ -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"
}
+1 -1
View File
@@ -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
}
},
{
+1 -1
View File
@@ -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"
}
},
+2 -2
View File
@@ -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",
+2 -2
View File
@@ -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],
+1 -1
View File
@@ -40,7 +40,7 @@
"context": "BufferSearchBar",
"bindings": {
"cmd-f3": "search::SelectNextMatch",
"cmd-shift-f3": "search::SelectPrevMatch"
"cmd-shift-f3": "search::SelectPreviousMatch"
}
},
{
+1 -1
View File
@@ -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"
}
},
+3 -3
View File
@@ -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"
}
},
{
+2 -2
View File
@@ -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],
+1 -1
View File
@@ -47,7 +47,7 @@
"context": "BufferSearchBar",
"bindings": {
"ctrl-s": "search::SelectNextMatch",
"ctrl-shift-s": "search::SelectPrevMatch"
"ctrl-shift-s": "search::SelectPreviousMatch"
}
},
{
+3 -3
View File
@@ -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",
+6 -6
View File
@@ -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",
+3 -3
View File
@@ -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<Self>,
) {
@@ -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))
+3 -3
View File
@@ -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<Self>) {
fn select_previous(&mut self, _: &SelectPrevious, _: &mut Window, cx: &mut Context<Self>) {
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))
+5 -5
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,
+4 -4
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>,
) {
+25 -25
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.
+3 -3
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,
+8 -3
View File
@@ -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<Self>) {
fn handle_select_prev(
&mut self,
_: &SelectPrevious,
window: &mut Window,
cx: &mut Context<Self>,
) {
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<Self>) {
+3 -3
View File
@@ -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::<Editor>(cx).unwrap();
+8 -3
View File
@@ -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<Self>) {
fn select_previous(
&mut self,
_: &SelectPrevious,
_window: &mut Window,
cx: &mut Context<Self>,
) {
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))
+3 -3
View File
@@ -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,
+1 -1
View File
@@ -15,7 +15,7 @@ actions!(
Cancel,
Confirm,
SecondaryConfirm,
SelectPrev,
SelectPrevious,
SelectNext,
SelectFirst,
SelectLast,
+97 -9
View File
@@ -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<Query> = LazyLock::new(|| {
@@ -265,6 +269,51 @@ static TRANSFORM_ARRAY: LazyLock<HashMap<(&str, &str), &str>> = 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<usize>, 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<HashMap<&str, &str>> =
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<HashMap<&str, &str>> = 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
+1 -1
View File
@@ -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),
+9 -9
View File
@@ -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<Self>) {
fn select_previous(&mut self, _: &SelectPrevious, window: &mut Window, cx: &mut Context<Self>) {
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()
+7 -2
View File
@@ -391,7 +391,12 @@ impl<D: PickerDelegate> Picker<D> {
}
}
fn select_prev(&mut self, _: &menu::SelectPrev, window: &mut Window, cx: &mut Context<Self>) {
fn select_previous(
&mut self,
_: &menu::SelectPrevious,
window: &mut Window,
cx: &mut Context<Self>,
) {
let count = self.delegate.match_count();
if count > 0 {
let index = self.delegate.selected_index();
@@ -786,7 +791,7 @@ impl<D: PickerDelegate> Render for Picker<D> {
// 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))
+7 -7
View File
@@ -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<Self>) {
fn select_previous(&mut self, _: &SelectPrevious, window: &mut Window, cx: &mut Context<Self>) {
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);
+1 -1
View File
@@ -245,7 +245,7 @@ impl NotebookEditor {
pub fn select_previous(
&mut self,
_: &menu::SelectPrev,
_: &menu::SelectPrevious,
window: &mut Window,
cx: &mut Context<Self>,
) {
+23 -21
View File
@@ -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| {
+8 -8
View File
@@ -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)))
+1 -1
View File
@@ -30,7 +30,7 @@ actions!(
ToggleReplace,
ToggleSelection,
SelectNextMatch,
SelectPrevMatch,
SelectPreviousMatch,
SelectAllMatches,
NextHistoryQuery,
PreviousHistoryQuery,
+1 -1
View File
@@ -620,7 +620,7 @@ mod tests {
// Standard macOS bindings
{
\"bindings\": {
\"up\": \"menu::SelectPrev\",
\"up\": \"menu::SelectPrevious\",
},
},
]
+2 -2
View File
@@ -114,10 +114,10 @@ impl PickerStory {
pub fn new(window: &mut Window, cx: &mut App) -> Entity<Self> {
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")),
@@ -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());
+8 -3
View File
@@ -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<Self>) {
pub fn select_previous(
&mut self,
_: &SelectPrevious,
window: &mut Window,
cx: &mut Context<Self>,
) {
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| {
+2 -2
View File
@@ -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));
+6 -4
View File
@@ -827,10 +827,12 @@ fn generate_commands(_: &App) -> Vec<VimCommand> {
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)
+1 -1
View File
@@ -189,7 +189,7 @@ pub fn app_menus() -> Vec<Menu> {
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 {
+7 -2
View File
@@ -102,7 +102,12 @@ impl FallbackPromptRenderer {
cx.notify();
}
fn select_prev(&mut self, _: &menu::SelectPrev, _window: &mut Window, cx: &mut Context<Self>) {
fn select_previous(
&mut self,
_: &menu::SelectPrevious,
_window: &mut Window,
cx: &mut Context<Self>,
) {
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)
+4 -4
View File
@@ -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,
}),
)
+7 -2
View File
@@ -82,7 +82,12 @@ impl RateCompletionModal {
cx.notify();
}
fn select_prev(&mut self, _: &menu::SelectPrev, _: &mut Window, cx: &mut Context<Self>) {
fn select_previous(
&mut self,
_: &menu::SelectPrevious,
_: &mut Window,
cx: &mut Context<Self>,
) {
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))