Skip to content

Commit

Permalink
Pune/India: more prominent selection in mark pane
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thiel committed Jun 7, 2019
1 parent b4669c0 commit b4a2e0e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
6 changes: 4 additions & 2 deletions src/interactive/widgets/entries.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::interactive::{
widgets::{EntryMarkMap, COLOR_MARKED, COLOR_MARKED_DARK, COLOR_MARKED_DARKER},
widgets::{
EntryMarkMap, COLOR_BYTESIZE_SELECTED, COLOR_MARKED, COLOR_MARKED_DARK, COLOR_MARKED_DARKER,
},
DisplayOptions, EntryDataBundle,
};
use dua::traverse::{Tree, TreeIndex};
Expand Down Expand Up @@ -118,7 +120,7 @@ impl Entries {
.into(),
Style {
fg: match (is_selected, *is_focussed) {
(true, true) => Color::DarkGray,
(true, true) => COLOR_BYTESIZE_SELECTED,
(true, false) => Color::Black,
_ => Color::Green,
},
Expand Down
37 changes: 26 additions & 11 deletions src/interactive/widgets/mark.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::interactive::{
fit_string_graphemes_with_ellipsis, widgets::COLOR_MARKED_LIGHT, CursorDirection,
use crate::{
interactive::widgets::{COLOR_BYTESIZE_SELECTED, COLOR_MARKED_LIGHT},
interactive::{fit_string_graphemes_with_ellipsis, CursorDirection},
};
use dua::{
path_of,
Expand Down Expand Up @@ -146,9 +147,15 @@ impl MarkPane {
.sorted_by_key(|v| &v.index)
.enumerate()
.map(|(idx, v)| {
let modifier = match selected {
Some(selected) if idx == selected => Modifier::BOLD,
_ => Modifier::empty(),
let (default_style, is_selected) = match selected {
Some(selected) if idx == selected => (
Style {
bg: Color::White,
..Default::default()
},
true,
),
_ => (Style::default(), false),
};
let (path, path_len) = {
let path = format!(" {} ", v.path.display());
Expand All @@ -168,9 +175,12 @@ impl MarkPane {
let path = Text::Styled(
path.into(),
Style {
fg: COLOR_MARKED_LIGHT,
modifier,
..Style::default()
fg: if is_selected {
Color::Black
} else {
COLOR_MARKED_LIGHT
},
..default_style
},
);
let bytes = Text::Styled(
Expand All @@ -181,11 +191,15 @@ impl MarkPane {
)
.into(),
Style {
fg: Color::Green,
..Default::default()
fg: if is_selected {
COLOR_BYTESIZE_SELECTED
} else {
Color::Green
},
..default_style
},
);
let spacer = Text::Raw(
let spacer = Text::Styled(
format!(
"{:-space$}",
"",
Expand All @@ -194,6 +208,7 @@ impl MarkPane {
.saturating_sub(format.total_width())
)
.into(),
default_style,
);
vec![path, spacer, bytes]
});
Expand Down
1 change: 1 addition & 0 deletions src/interactive/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub use mark::*;

use tui::style::Color;

pub const COLOR_BYTESIZE_SELECTED: Color = Color::DarkGray;
pub const COLOR_MARKED: Color = Color::Yellow;
pub const COLOR_MARKED_LIGHT: Color = Color::LightYellow;
pub const COLOR_MARKED_DARK: Color = Color::Rgb(176, 126, 0);
Expand Down

0 comments on commit b4a2e0e

Please sign in to comment.