mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-26 12:17:19 +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(
|
pub fn handle_input(
|
||||||
&mut self,
|
&mut self,
|
||||||
input: Key,
|
input: Key,
|
||||||
|
@ -1662,6 +1670,9 @@ impl TTApp {
|
||||||
} else if input == self.keyconfig.select {
|
} else if input == self.keyconfig.select {
|
||||||
self.task_table_state.multiple_selection();
|
self.task_table_state.multiple_selection();
|
||||||
self.toggle_mark();
|
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 {
|
} else if input == self.keyconfig.refresh {
|
||||||
self.update(true)?;
|
self.update(true)?;
|
||||||
} else if input == self.keyconfig.go_to_bottom || input == Key::End {
|
} else if input == self.keyconfig.go_to_bottom || input == Key::End {
|
||||||
|
|
|
@ -19,6 +19,7 @@ pub struct KeyConfig {
|
||||||
pub done: Key,
|
pub done: Key,
|
||||||
pub start_stop: Key,
|
pub start_stop: Key,
|
||||||
pub select: Key,
|
pub select: Key,
|
||||||
|
pub select_all: Key,
|
||||||
pub undo: Key,
|
pub undo: Key,
|
||||||
pub edit: Key,
|
pub edit: Key,
|
||||||
pub modify: Key,
|
pub modify: Key,
|
||||||
|
@ -59,6 +60,7 @@ impl Default for KeyConfig {
|
||||||
done: Key::Char('d'),
|
done: Key::Char('d'),
|
||||||
start_stop: Key::Char('s'),
|
start_stop: Key::Char('s'),
|
||||||
select: Key::Char('v'),
|
select: Key::Char('v'),
|
||||||
|
select_all: Key::Char('V'),
|
||||||
undo: Key::Char('u'),
|
undo: Key::Char('u'),
|
||||||
edit: Key::Char('e'),
|
edit: Key::Char('e'),
|
||||||
modify: Key::Char('m'),
|
modify: Key::Char('m'),
|
||||||
|
@ -122,6 +124,9 @@ impl KeyConfig {
|
||||||
self.select = self
|
self.select = self
|
||||||
.get_config("uda.taskwarrior-tui.keyconfig.select")
|
.get_config("uda.taskwarrior-tui.keyconfig.select")
|
||||||
.unwrap_or(self.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
|
self.undo = self
|
||||||
.get_config("uda.taskwarrior-tui.keyconfig.undo")
|
.get_config("uda.taskwarrior-tui.keyconfig.undo")
|
||||||
.unwrap_or(self.undo);
|
.unwrap_or(self.undo);
|
||||||
|
@ -170,6 +175,7 @@ impl KeyConfig {
|
||||||
&self.delete,
|
&self.delete,
|
||||||
&self.done,
|
&self.done,
|
||||||
&self.select,
|
&self.select,
|
||||||
|
&self.select_all,
|
||||||
&self.start_stop,
|
&self.start_stop,
|
||||||
&self.undo,
|
&self.undo,
|
||||||
&self.edit,
|
&self.edit,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue