new path picker (#11015)

Still TODO:

* Disable the new save-as for local projects
* Wire up sending the new path to the remote server

Release Notes:

- Added the ability to "Save-as" in remote projects

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Bennet <bennetbo@gmx.de>
This commit is contained in:
Conrad Irwin
2024-04-26 13:25:25 -06:00
committed by GitHub
co-authored by Nathan Bennet
parent 314b723292
commit 664f779eb4
27 changed files with 775 additions and 149 deletions
+5 -1
View File
@@ -693,7 +693,7 @@ pub struct PathPromptOptions {
}
/// What kind of prompt styling to show
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum PromptLevel {
/// A prompt that is shown when the user should be notified of something
Info,
@@ -703,6 +703,10 @@ pub enum PromptLevel {
/// A prompt that is shown when a critical problem has occurred
Critical,
/// A prompt that is shown when asking the user to confirm a potentially destructive action
/// (overwriting a file for example)
Destructive,
}
/// The style of the cursor (pointer)
+8 -1
View File
@@ -904,7 +904,7 @@ impl PlatformWindow for MacWindow {
let alert_style = match level {
PromptLevel::Info => 1,
PromptLevel::Warning => 0,
PromptLevel::Critical => 2,
PromptLevel::Critical | PromptLevel::Destructive => 2,
};
let _: () = msg_send![alert, setAlertStyle: alert_style];
let _: () = msg_send![alert, setMessageText: ns_string(msg)];
@@ -919,10 +919,17 @@ impl PlatformWindow for MacWindow {
{
let button: id = msg_send![alert, addButtonWithTitle: ns_string(answer)];
let _: () = msg_send![button, setTag: ix as NSInteger];
if level == PromptLevel::Destructive && answer != &"Cancel" {
let _: () = msg_send![button, setHasDestructiveAction: YES];
}
}
if let Some((ix, answer)) = latest_non_cancel_label {
let button: id = msg_send![alert, addButtonWithTitle: ns_string(answer)];
let _: () = msg_send![button, setTag: ix as NSInteger];
let _: () = msg_send![button, setHasDestructiveAction: YES];
if level == PromptLevel::Destructive {
let _: () = msg_send![button, setHasDestructiveAction: YES];
}
}
let (done_tx, done_rx) = oneshot::channel();
+1 -1
View File
@@ -1455,7 +1455,7 @@ impl PlatformWindow for WindowsWindow {
title = windows::core::w!("Warning");
main_icon = TD_WARNING_ICON;
}
crate::PromptLevel::Critical => {
crate::PromptLevel::Critical | crate::PromptLevel::Destructive => {
title = windows::core::w!("Critical");
main_icon = TD_ERROR_ICON;
}
+7
View File
@@ -628,6 +628,13 @@ impl From<&TextStyle> for HighlightStyle {
}
impl HighlightStyle {
/// Create a highlight style with just a color
pub fn color(color: Hsla) -> Self {
Self {
color: Some(color),
..Default::default()
}
}
/// Blend this highlight style with another.
/// Non-continuous properties, like font_weight and font_style, are overwritten.
pub fn highlight(&mut self, other: HighlightStyle) {