Skip to content

Commit

Permalink
Only show hotkey for deletion when focus is on the mark pane
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thiel committed Jun 7, 2019
1 parent f34ceeb commit 05ed8c4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 33 deletions.
9 changes: 9 additions & 0 deletions src/interactive/widgets/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ impl HelpPane {
hotkey("<space bar>", "Toggle the currently selected entry", None);
spacer();
}
title("Keys in the Mark pane");
{
hotkey(
"Ctrl + Shift + r",
"Permanently delete all marked entries without prompt!",
None,
);
spacer();
}
title("Keys for application control");
{
hotkey(
Expand Down
73 changes: 40 additions & 33 deletions src/interactive/widgets/mark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,41 +185,48 @@ impl MarkPane {
let inner_area = block.inner(area);
block.draw(area, buf);

let (help_line_area, list_area) = {
let regions = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Length(1), Constraint::Max(256)].as_ref())
.split(inner_area);
(regions[0], regions[1])
};
let list_area = if self.has_focus {
let (help_line_area, list_area) = {
let regions = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Length(1), Constraint::Max(256)].as_ref())
.split(inner_area);
(regions[0], regions[1])
};

let default_style = Style {
fg: Color::Black,
bg: Color::White,
modifier: Modifier::BOLD,
..Default::default()
let default_style = Style {
fg: Color::Black,
bg: Color::White,
modifier: Modifier::BOLD,
..Default::default()
};
Paragraph::new(
[
Text::Styled(
" Ctrl + Shift + r".into(),
Style {
fg: Color::Red,
modifier: default_style.modifier | Modifier::RAPID_BLINK,
..default_style
},
),
Text::Styled(
" permanently deletes list without prompt".into(),
default_style,
),
]
.iter(),
)
.style(Style {
bg: Color::White,
..Style::default()
})
.draw(help_line_area, buf);
list_area
} else {
inner_area
};
Paragraph::new(
[
Text::Styled(
" Ctrl + Shift + r".into(),
Style {
fg: Color::Red,
..default_style
},
),
Text::Styled(
" permanently deletes list without prompt".into(),
default_style,
),
]
.iter(),
)
.style(Style {
bg: Color::White,
..Style::default()
})
.draw(help_line_area, buf);

let props = ListProps {
block: None,
entry_in_view,
Expand Down

0 comments on commit 05ed8c4

Please sign in to comment.