mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-08-28 21:06:56 +02:00
This commit is contained in:
parent
7fcab73b04
commit
62f30daac6
6 changed files with 295 additions and 195 deletions
|
|
@ -19,8 +19,8 @@ impl Browse {
|
|||
todo!()
|
||||
}
|
||||
/// Set current directory
|
||||
#[command(SetPath = "set-path")]
|
||||
fn set_path (&mut self, _path: PathBuf) -> Perhaps<BrowseCommand> {
|
||||
#[command(Chdir = "chdir")]
|
||||
fn chdir (&mut self, _path: PathBuf) -> Perhaps<BrowseCommand> {
|
||||
todo!()
|
||||
}
|
||||
/// Set current filter
|
||||
|
|
@ -35,15 +35,6 @@ impl Browse {
|
|||
}
|
||||
}
|
||||
|
||||
def_command!(FileBrowserCommand: |_browse: Browse|{
|
||||
//("begin" [] Some(Self::Begin))
|
||||
//("cancel" [] Some(Self::Cancel))
|
||||
//("confirm" [] Some(Self::Confirm))
|
||||
//("select" [i: usize] Some(Self::Select(i.expect("no index"))))
|
||||
//("chdir" [p: PathBuf] Some(Self::Chdir(p.expect("no path"))))
|
||||
//("filter" [f: Arc<str>] Some(Self::Filter(f.expect("no filter")))))
|
||||
});
|
||||
|
||||
/// Browses for files to load/save.
|
||||
///
|
||||
/// ```
|
||||
|
|
@ -104,7 +95,7 @@ impl Browse {
|
|||
}
|
||||
Ok(Self { cwd, dirs, files, ..Default::default() })
|
||||
}
|
||||
pub fn chdir (&self) -> Usually<Self> { Self::new(Some(self.path())) }
|
||||
pub fn to_chdir (&self) -> Usually<Self> { Self::new(Some(self.path())) }
|
||||
pub fn len (&self) -> usize { self.dirs.len() + self.files.len() }
|
||||
pub fn is_dir (&self) -> bool { self.index < self.dirs.len() }
|
||||
pub fn is_file (&self) -> bool { self.index >= self.dirs.len() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue