diff options
author | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-06 11:22:30 +0530 |
---|---|---|
committer | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-06 11:22:30 +0530 |
commit | 22902a5889ab36303aed53c0d2fe57a3be919474 (patch) | |
tree | 1de6e61d85518178ffe742f98df7d2db56b8a5f3 /src/interactive/widgets/entries.rs | |
parent | 2f3f214e03de477ad05aa12a1ac2ba0775a36c14 (diff) |
Coloring for marked entries
Diffstat (limited to 'src/interactive/widgets/entries.rs')
-rw-r--r-- | src/interactive/widgets/entries.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/interactive/widgets/entries.rs b/src/interactive/widgets/entries.rs index f364110..5f793a0 100644 --- a/src/interactive/widgets/entries.rs +++ b/src/interactive/widgets/entries.rs @@ -1,4 +1,4 @@ -use crate::interactive::{DisplayOptions, EntryDataBundle, EntryMark}; +use crate::interactive::{DisplayOptions, EntryDataBundle, EntryMarkMap}; use dua::traverse::{Tree, TreeIndex}; use itertools::Itertools; use std::{borrow::Borrow, path::Path}; @@ -16,7 +16,7 @@ pub struct EntriesProps<'a> { pub display: DisplayOptions, pub selected: Option<TreeIndex>, pub entries: &'a [EntryDataBundle], - pub marked: &'a [EntryMark], + pub marked: &'a EntryMarkMap, pub border_style: Style, pub is_focussed: bool, } @@ -39,7 +39,7 @@ impl Entries { display, entries, selected, - marked: _, + marked, border_style, is_focussed, } = props.borrow(); @@ -131,6 +131,7 @@ impl Entries { style, ); + let dark_yellow = Color::Rgb(176, 126, 0); let name = Text::Styled( fill_background_to_right( format!( @@ -142,11 +143,16 @@ impl Entries { ) .into(), Style { - fg: match (!is_dir, exists) { - (true, true) if !is_selected => Color::DarkGray, - (true, true) => style.fg, - (_, false) => Color::Red, - (false, true) => style.fg, + fg: match (!is_dir, exists, marked.contains_key(node_idx)) { + (true, true, false) if !is_selected => Color::DarkGray, + (true, true, false) => style.fg, + (false, true, false) => style.fg, + + (true, true, true) => dark_yellow, + (false, true, true) => Color::Yellow, + + // non-existing - always red! + (_, false, _) => Color::Red, }, ..style }, |