From 915fd9ebafe4f5ee86421697725176edbb961c43 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Wed, 24 Mar 2021 16:26:53 +0900 Subject: Restore buffer_picker. --- helix-term/src/ui/mod.rs | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) (limited to 'helix-term/src/ui/mod.rs') 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 { use ignore::Walk; // TODO: determine root based on git root @@ -109,36 +110,6 @@ pub fn file_picker(root: &str) -> Picker { ) } -use helix_view::View; -pub fn buffer_picker(buffers: &[Document], current: usize) -> Picker<(Option, 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, 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, usize)| { - // if index < editor.views.len() { - // editor.focus = index; - // } - }, - ) -} - pub mod completers { use crate::ui::prompt::Completion; use std::borrow::Cow; -- cgit v1.2.3-70-g09d2