diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index a24c4aff6900b14b939767b4b5caca6abb9c4486..332e3a7414fa5bb6f6a8b05221fa45c2e5b481f5 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -234,7 +234,8 @@ "escape": [ "vim::SwitchMode", "Normal" - ] + ], + "d": "editor::GoToDefinition" } }, { diff --git a/crates/feedback/src/feedback.rs b/crates/feedback/src/feedback.rs index f95f24f557485211a854e5de680310f5fac50784..cd72cdf9508951c0ddfd4e8f68b0ce7f55c026de 100644 --- a/crates/feedback/src/feedback.rs +++ b/crates/feedback/src/feedback.rs @@ -20,7 +20,12 @@ impl_actions!(zed, [OpenBrowser]); actions!( zed, - [CopySystemSpecsIntoClipboard, FileBugReport, RequestFeature] + [ + CopySystemSpecsIntoClipboard, + FileBugReport, + RequestFeature, + OpenZedCommunityRepo + ] ); pub fn init(app_state: Arc, cx: &mut MutableAppContext) { @@ -66,4 +71,11 @@ pub fn init(app_state: Arc, cx: &mut MutableAppContext) { }); }, ); + + cx.add_action( + |_: &mut Workspace, _: &OpenZedCommunityRepo, cx: &mut ViewContext| { + let url = "https://github.com/zed-industries/community"; + cx.dispatch_action(OpenBrowser { url: url.into() }); + }, + ); } diff --git a/crates/feedback/src/feedback_info_text.rs b/crates/feedback/src/feedback_info_text.rs index 6693a7cb44f9c1ff9005cdf169f20b90c82ec625..8c3105010983d7a18bf9fefc71c92402a54faa33 100644 --- a/crates/feedback/src/feedback_info_text.rs +++ b/crates/feedback/src/feedback_info_text.rs @@ -1,10 +1,12 @@ use gpui::{ - elements::Label, Element, ElementBox, Entity, RenderContext, View, ViewContext, ViewHandle, + elements::{Flex, Label, MouseEventHandler, ParentElement, Text}, + CursorStyle, Element, ElementBox, Entity, MouseButton, RenderContext, View, ViewContext, + ViewHandle, }; use settings::Settings; use workspace::{item::ItemHandle, ToolbarItemLocation, ToolbarItemView}; -use crate::feedback_editor::FeedbackEditor; +use crate::{feedback_editor::FeedbackEditor, OpenZedCommunityRepo}; pub struct FeedbackInfoText { active_item: Option>, @@ -29,9 +31,44 @@ impl View for FeedbackInfoText { fn render(&mut self, cx: &mut RenderContext) -> ElementBox { let theme = cx.global::().theme.clone(); - let text = "We read whatever you submit here. For issues and discussions, visit the community repo on GitHub."; - Label::new(text, theme.feedback.info_text.text.clone()) - .contained() + + Flex::row() + .with_child( + Text::new( + "We read whatever you submit here. For issues and discussions, visit the ", + theme.feedback.info_text_default.text.clone(), + ) + .with_soft_wrap(false) + .aligned() + .boxed(), + ) + .with_child( + MouseEventHandler::::new(0, cx, |state, _| { + let contained_text = if state.hovered() { + &theme.feedback.link_text_hover + } else { + &theme.feedback.link_text_default + }; + + Label::new("community repo", contained_text.text.clone()) + .contained() + .aligned() + .left() + .clipped() + .boxed() + }) + .with_cursor_style(CursorStyle::PointingHand) + .on_click(MouseButton::Left, |_, cx| { + cx.dispatch_action(OpenZedCommunityRepo) + }) + .boxed(), + ) + .with_child( + Text::new(" on GitHub.", theme.feedback.info_text_default.text.clone()) + .with_soft_wrap(false) + .aligned() + .boxed(), + ) .aligned() .left() .clipped() diff --git a/crates/fuzzy/src/paths.rs b/crates/fuzzy/src/paths.rs index 2c5ce81b1ccd09def80c7938aa1fe8591323500b..1cb7174fcce1dc6dd2e9a4821250389cc5c339b3 100644 --- a/crates/fuzzy/src/paths.rs +++ b/crates/fuzzy/src/paths.rs @@ -198,6 +198,23 @@ fn distance_between_paths(path: &Path, relative_to: &Path) -> usize { let mut path_components = path.components(); let mut relative_components = relative_to.components(); - while path_components.next() == relative_components.next() {} + while path_components + .next() + .zip(relative_components.next()) + .map(|(path_component, relative_component)| path_component == relative_component) + .unwrap_or_default() + {} path_components.count() + relative_components.count() + 1 } + +#[cfg(test)] +mod tests { + use std::path::Path; + + use super::distance_between_paths; + + #[test] + fn test_distance_between_paths_empty() { + distance_between_paths(Path::new(""), Path::new("")); + } +} diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 4e10b81447bd4843758ae8f985bdc9e6313d954c..efe64cbc5c6e13de876c757847f3f96514ff3a85 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -821,7 +821,9 @@ pub struct TerminalStyle { pub struct FeedbackStyle { pub submit_button: Interactive, pub button_margin: f32, - pub info_text: ContainedText, + pub info_text_default: ContainedText, + pub link_text_default: ContainedText, + pub link_text_hover: ContainedText, } #[derive(Clone, Deserialize, Default)] diff --git a/crates/zed/resources/app-icon-preview.png b/crates/zed/resources/app-icon-preview.png index 2d6ade1dd348a934ebec7342c0249560125d0bb7..ce2a639e2cd9c77ee5bd56bb13fe397414110c0c 100644 Binary files a/crates/zed/resources/app-icon-preview.png and b/crates/zed/resources/app-icon-preview.png differ diff --git a/crates/zed/resources/app-icon-preview@2x.png b/crates/zed/resources/app-icon-preview@2x.png index 0a55727e413ad5679cffbd8c14d2f1086f6b572f..f22b8523f9fab4a66c5de3cd75ecbbacfb387766 100644 Binary files a/crates/zed/resources/app-icon-preview@2x.png and b/crates/zed/resources/app-icon-preview@2x.png differ diff --git a/crates/zed/resources/app-icon.png b/crates/zed/resources/app-icon.png index 6c8a1b6bd42daf6654c6c1808e58fba3c8c9e140..08b6d8afa0d1088e50f1e9697e01407c9c623f6d 100644 Binary files a/crates/zed/resources/app-icon.png and b/crates/zed/resources/app-icon.png differ diff --git a/crates/zed/resources/app-icon@2x.png b/crates/zed/resources/app-icon@2x.png index 3509df92caf25f4b25dfdc7e8c93a946f7d94354..5bb5754bc19c1ae81a7f1c1e48e0aa1c739486e3 100644 Binary files a/crates/zed/resources/app-icon@2x.png and b/crates/zed/resources/app-icon@2x.png differ diff --git a/styles/src/styleTree/feedback.ts b/styles/src/styleTree/feedback.ts index 9d09058842fc4144083e2c4d22a59094c249f040..d7946744397f629324af4c832e1c704c58cbe6c8 100644 --- a/styles/src/styleTree/feedback.ts +++ b/styles/src/styleTree/feedback.ts @@ -31,6 +31,8 @@ export default function feedback(colorScheme: ColorScheme) { }, }, button_margin: 8, - info_text: text(layer, "sans", "default", { size: "xs" }), + info_text_default: text(layer, "sans", "default", { size: "xs" }), + link_text_default: text(layer, "sans", "default", { size: "xs", underline: true }), + link_text_hover: text(layer, "sans", "hovered", { size: "xs", underline: true }) } }