From 263023021d80f6caa08c23ea25dea4615cdb5594 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 16 Apr 2024 13:00:25 +0200 Subject: [PATCH] Show Zoom In/Out shortcuts in the labels (#10604) Based on https://github.com/zed-industries/zed/discussions/10599 Does the same as the assistant tab with the Zoom In/Out labels. ![image](https://github.com/zed-industries/zed/assets/2690773/afc59a3e-c3df-4fc8-bcaf-1d45a21aecf7) Release Notes: - Adjusted Zoom In/Out for Pane and Terminal Pane to show keybinding labels --- crates/terminal_view/src/terminal_panel.rs | 9 +++++++-- crates/workspace/src/pane.rs | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index d96eefba00..83cc9efa1f 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -26,7 +26,7 @@ use workspace::{ item::Item, pane, ui::IconName, - DraggedTab, NewTerminal, Pane, Workspace, + DraggedTab, NewTerminal, Pane, ToggleZoom, Workspace, }; use anyhow::Result; @@ -98,8 +98,13 @@ impl TerminalPanel { .on_click(cx.listener(|pane, _, cx| { pane.toggle_zoom(&workspace::ToggleZoom, cx); })) + // TODO kb .tooltip(move |cx| { - Tooltip::text(if zoomed { "Zoom Out" } else { "Zoom In" }, cx) + Tooltip::for_action( + if zoomed { "Zoom Out" } else { "Zoom In" }, + &ToggleZoom, + cx, + ) }) }) .into_any_element() diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 6bfd16e528..c8658699ca 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -365,7 +365,11 @@ impl Pane { pane.toggle_zoom(&crate::ToggleZoom, cx); })) .tooltip(move |cx| { - Tooltip::text(if zoomed { "Zoom Out" } else { "Zoom In" }, cx) + Tooltip::for_action( + if zoomed { "Zoom Out" } else { "Zoom In" }, + &ToggleZoom, + cx, + ) }) }) .when_some(pane.split_item_menu.as_ref(), |el, split_item_menu| {