Rework file picker for SSH modal (#19020)
This PR changes the SSH modal design so its more keyboard navigation-friendly and adds the server nickname feature. Release Notes: - N/A --------- Co-authored-by: Danilo <danilo@zed.dev> Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
This commit is contained in:
parent
be7b24fcf7
commit
db7417f3b5
12 changed files with 871 additions and 491 deletions
|
@ -5,6 +5,8 @@ mod file_finder_settings;
|
|||
mod new_path_prompt;
|
||||
mod open_path_prompt;
|
||||
|
||||
pub use open_path_prompt::OpenPathDelegate;
|
||||
|
||||
use collections::HashMap;
|
||||
use editor::{scroll::Autoscroll, Bias, Editor};
|
||||
use file_finder_settings::FileFinderSettings;
|
||||
|
|
|
@ -26,6 +26,20 @@ pub struct OpenPathDelegate {
|
|||
should_dismiss: bool,
|
||||
}
|
||||
|
||||
impl OpenPathDelegate {
|
||||
pub fn new(tx: oneshot::Sender<Option<Vec<PathBuf>>>, lister: DirectoryLister) -> Self {
|
||||
Self {
|
||||
tx: Some(tx),
|
||||
lister,
|
||||
selected_index: 0,
|
||||
directory_state: None,
|
||||
matches: Vec::new(),
|
||||
cancel_flag: Arc::new(AtomicBool::new(false)),
|
||||
should_dismiss: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DirectoryState {
|
||||
path: String,
|
||||
match_candidates: Vec<StringMatchCandidate>,
|
||||
|
@ -48,15 +62,7 @@ impl OpenPathPrompt {
|
|||
cx: &mut ViewContext<Workspace>,
|
||||
) {
|
||||
workspace.toggle_modal(cx, |cx| {
|
||||
let delegate = OpenPathDelegate {
|
||||
tx: Some(tx),
|
||||
lister: lister.clone(),
|
||||
selected_index: 0,
|
||||
directory_state: None,
|
||||
matches: Vec::new(),
|
||||
cancel_flag: Arc::new(AtomicBool::new(false)),
|
||||
should_dismiss: true,
|
||||
};
|
||||
let delegate = OpenPathDelegate::new(tx, lister.clone());
|
||||
|
||||
let picker = Picker::uniform_list(delegate, cx).width(rems(34.));
|
||||
let query = lister.default_query(cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue