add clear all selections

This commit is contained in:
rabite 2019-06-18 13:34:15 +02:00
parent 0fec7e95a2
commit 85ff9d777c
2 changed files with 10 additions and 0 deletions

View File

@ -193,6 +193,7 @@ By default hunter uses vi-style keybindings. If you use a QWERTY-like keyboard l
| space | multi select file |
| Alt(space) | select with external program |
| v | invert selections |
| V | clear all selections |
| t | toggle tag |
| h | toggle show hidden |
| r | reverse sort |

View File

@ -83,6 +83,7 @@ impl Listable for ListView<Files> {
Key::Right => self.goto_selected()?,
Key::Char(' ') => self.multi_select_file(),
Key::Char('v') => self.invert_selection(),
Key::Char('V') => self.clear_selections(),
Key::Char('t') => self.toggle_tag()?,
Key::Char('H') => self.toggle_hidden(),
Key::Char('r') => self.reverse_sort(),
@ -369,6 +370,14 @@ impl ListView<Files>
self.refresh().log();
}
pub fn clear_selections(&mut self) {
for file in self.content.get_files_mut() {
file.selected = false;
}
self.content.set_dirty();
self.refresh().log();
}
fn toggle_tag(&mut self) -> HResult<()> {
self.selected_file_mut().toggle_tag()?;