diff options
author | Blaž Hrastnik | 2021-03-24 07:26:53 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-03-24 07:26:53 +0000 |
commit | 915fd9ebafe4f5ee86421697725176edbb961c43 (patch) | |
tree | 01857ba394dd5019edc6a191568fefc95a911448 /helix-term/src/ui | |
parent | 376232c5439c8c74cf5dcb4b46e94a7a1d221fc8 (diff) |
Restore buffer_picker.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/mod.rs | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index a625aa14..f7f77d0c 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -20,6 +20,8 @@ pub use tui::style::{Color, Modifier, Style}; use helix_core::regex::Regex; use helix_view::{Document, Editor}; +use std::path::{Path, PathBuf}; + // TODO: temp #[inline(always)] pub fn text_color() -> Style { @@ -75,7 +77,6 @@ pub fn regex_prompt( ) } -use std::path::{Path, PathBuf}; pub fn file_picker(root: &str) -> Picker<PathBuf> { use ignore::Walk; // TODO: determine root based on git root @@ -109,36 +110,6 @@ pub fn file_picker(root: &str) -> Picker<PathBuf> { ) } -use helix_view::View; -pub fn buffer_picker(buffers: &[Document], current: usize) -> Picker<(Option<PathBuf>, usize)> { - use helix_view::Editor; - Picker::new( - buffers - .iter() - .enumerate() - .map(|(i, doc)| (doc.relative_path().map(Path::to_path_buf), i)) - .collect(), - move |(path, index): &(Option<PathBuf>, usize)| { - // format_fn - match path { - Some(path) => { - if *index == current { - format!("{} (*)", path.to_str().unwrap()).into() - } else { - path.to_str().unwrap().into() - } - } - None => "[NEW]".into(), - } - }, - |editor: &mut Editor, &(_, index): &(Option<PathBuf>, usize)| { - // if index < editor.views.len() { - // editor.focus = index; - // } - }, - ) -} - pub mod completers { use crate::ui::prompt::Completion; use std::borrow::Cow; |