Skip to content

Commit 7ad9ca9

Browse files
authored
editor: Replace hardcoded keystroke in Excerpt Fold Toggle tooltip (#38978)
# Why I have recently corrected this tooltip content for macOS, but recently have learnt that keystroke to text helpers already exist in the codebase. # How Replace hardcoded keystroke for Excerpt Fold Toggle in Uncommitted Changes tab. > [!important] > Should be merged after #38969 and #38971, otherwise it would be a regression on macOS. Release Notes: - N/A # Preview (stacked on mentioned above PRs) <img width="618" height="248" alt="Screenshot 2025-09-26 at 17 43 53" src="https://github.com/user-attachments/assets/cdc7fb74-e1d8-4a59-b847-8a8d2edd4641" />
1 parent a55dff7 commit 7ad9ca9

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

crates/editor/src/element.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use gpui::{
4343
Bounds, ClickEvent, ClipboardItem, ContentMask, Context, Corner, Corners, CursorStyle,
4444
DispatchPhase, Edges, Element, ElementInputHandler, Entity, Focusable as _, FontId,
4545
GlobalElementId, Hitbox, HitboxBehavior, Hsla, InteractiveElement, IntoElement, IsZero,
46-
KeybindingKeystroke, Length, ModifiersChangedEvent, MouseButton, MouseClickEvent,
46+
KeybindingKeystroke, Length, Modifiers, ModifiersChangedEvent, MouseButton, MouseClickEvent,
4747
MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, ParentElement, Pixels, ScrollDelta,
4848
ScrollHandle, ScrollWheelEvent, ShapedLine, SharedString, Size, StatefulInteractiveElement,
4949
Style, Styled, TextRun, TextStyleRefinement, WeakEntity, Window, anchored, deferred, div, fill,
@@ -86,7 +86,7 @@ use theme::{ActiveTheme, Appearance, BufferLineHeight, PlayerColor};
8686
use ui::utils::ensure_minimum_contrast;
8787
use ui::{
8888
ButtonLike, ContextMenu, Indicator, KeyBinding, POPOVER_Y_PADDING, Tooltip, h_flex, prelude::*,
89-
right_click_menu, scrollbars::ShowScrollbar,
89+
right_click_menu, scrollbars::ShowScrollbar, text_for_keystroke,
9090
};
9191
use unicode_segmentation::UnicodeSegmentation;
9292
use util::post_inc;
@@ -3844,11 +3844,14 @@ impl EditorElement {
38443844
Tooltip::with_meta_in(
38453845
"Toggle Excerpt Fold",
38463846
Some(&ToggleFold),
3847-
if cfg!(target_os = "macos") {
3848-
"Option+click to toggle all"
3849-
} else {
3850-
"Alt+click to toggle all"
3851-
},
3847+
format!(
3848+
"{} to toggle all",
3849+
text_for_keystroke(
3850+
&Modifiers::alt(),
3851+
"click",
3852+
cx
3853+
)
3854+
),
38523855
&focus_handle,
38533856
window,
38543857
cx,

0 commit comments

Comments
 (0)