keymap: Update Prev to Previous for consistency (#25909)

Closes #10167

This is take 2 on https://github.com/zed-industries/zed/pull/2341 which
was closed due to lack of migrator.

This PR contains rename of following keymap actions: 
```sh
1. ["editor::GoToPrevHunk", { "center_cursor": true }] -> ["editor::GoToPreviousHunk", { "center_cursor": true }]
2. "editor::GoToPrevDiagnostic" -> "editor::GoToPreviousDiagnostic"
3. "editor::ContextMenuPrev" -> "editor::ContextMenuPrevious"
4. "search::SelectPrevMatch" -> "search::SelectPreviousMatch"
5. "file_finder::SelectPrev" -> "file_finder::SelectPrevious"
6. "menu::SelectPrev" -> "menu::SelectPrevious"
7. "editor::TabPrev" -> "editor::Backtab"
```

Release Notes:

- Renamed several keymap actions for consistency (e.g., `GoToPrevHunk` →
`GoToPreviousHunk`, `TabPrev` → `Backtab`). Your existing configured
keybindings will still work. You can click **"Backup and Update"** at
the top of your keymap file to easily update to the new actions.


Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
This commit is contained in:
smit 2025-03-03 17:44:49 +05:30 committed by GitHub
parent 61d584db45
commit 593f3dc1d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 320 additions and 198 deletions

View file

@ -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| {

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));