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:
co-authored by
Nathan
Bennet
parent
314b723292
commit
664f779eb4
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user