aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/mod.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-21 08:58:54 +0000
committerBlaž Hrastnik2020-12-21 08:58:54 +0000
commit47e282804d4206050a24ce3d1bfa18086b755265 (patch)
treee79f1376c3d5e92fffb21e8f38a724b7602e878c /helix-term/src/ui/mod.rs
parent3d3295bb759994d4fbf328c126678f63e0c38d4f (diff)
buffer picker: Mark current view with (*)
Diffstat (limited to 'helix-term/src/ui/mod.rs')
-rw-r--r--helix-term/src/ui/mod.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index f9480dd4..4daf82fc 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -38,7 +38,7 @@ pub fn file_picker(root: &str) -> Picker<PathBuf> {
files.take(MAX).collect(),
|path: &PathBuf| {
// format_fn
- path.strip_prefix("./").unwrap().to_str().unwrap()
+ path.strip_prefix("./").unwrap().to_str().unwrap().into()
},
|editor: &mut Editor, path: &PathBuf| {
let size = editor.view().unwrap().size;
@@ -56,11 +56,17 @@ pub fn buffer_picker(views: &[View], current: usize) -> Picker<(Option<PathBuf>,
.enumerate()
.map(|(i, view)| (view.doc.relative_path().map(Path::to_path_buf), i))
.collect(),
- |(path, index): &(Option<PathBuf>, usize)| {
+ move |(path, index): &(Option<PathBuf>, usize)| {
// format_fn
match path {
- Some(path) => path.to_str().unwrap(),
- None => "[NEW]",
+ 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)| {