mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 08:47:18 +02:00
Add select all option
This commit is contained in:
parent
b6945ec785
commit
2061d0e914
2 changed files with 17 additions and 0 deletions
11
src/app.rs
11
src/app.rs
|
@ -1646,6 +1646,14 @@ impl TTApp {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn toggle_mark_all(&mut self) {
|
||||
for task in &*self.tasks.lock().unwrap() {
|
||||
if !self.marked.insert(*task.uuid()) {
|
||||
self.marked.remove(task.uuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_input(
|
||||
&mut self,
|
||||
input: Key,
|
||||
|
@ -1662,6 +1670,9 @@ impl TTApp {
|
|||
} else if input == self.keyconfig.select {
|
||||
self.task_table_state.multiple_selection();
|
||||
self.toggle_mark();
|
||||
} else if input == self.keyconfig.select_all {
|
||||
self.task_table_state.multiple_selection();
|
||||
self.toggle_mark_all();
|
||||
} else if input == self.keyconfig.refresh {
|
||||
self.update(true)?;
|
||||
} else if input == self.keyconfig.go_to_bottom || input == Key::End {
|
||||
|
|
|
@ -19,6 +19,7 @@ pub struct KeyConfig {
|
|||
pub done: Key,
|
||||
pub start_stop: Key,
|
||||
pub select: Key,
|
||||
pub select_all: Key,
|
||||
pub undo: Key,
|
||||
pub edit: Key,
|
||||
pub modify: Key,
|
||||
|
@ -59,6 +60,7 @@ impl Default for KeyConfig {
|
|||
done: Key::Char('d'),
|
||||
start_stop: Key::Char('s'),
|
||||
select: Key::Char('v'),
|
||||
select_all: Key::Char('V'),
|
||||
undo: Key::Char('u'),
|
||||
edit: Key::Char('e'),
|
||||
modify: Key::Char('m'),
|
||||
|
@ -122,6 +124,9 @@ impl KeyConfig {
|
|||
self.select = self
|
||||
.get_config("uda.taskwarrior-tui.keyconfig.select")
|
||||
.unwrap_or(self.select);
|
||||
self.select_all = self
|
||||
.get_config("uda.taskwarrior-tui.keyconfig.select-all")
|
||||
.unwrap_or(self.select_all);
|
||||
self.undo = self
|
||||
.get_config("uda.taskwarrior-tui.keyconfig.undo")
|
||||
.unwrap_or(self.undo);
|
||||
|
@ -170,6 +175,7 @@ impl KeyConfig {
|
|||
&self.delete,
|
||||
&self.done,
|
||||
&self.select,
|
||||
&self.select_all,
|
||||
&self.start_stop,
|
||||
&self.undo,
|
||||
&self.edit,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue