mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-24 05:26:42 +02:00
Fix crashes
This commit is contained in:
parent
75141ef561
commit
b7b6a0f65c
2 changed files with 22 additions and 1 deletions
14
.gitignore
vendored
14
.gitignore
vendored
|
@ -1 +1,13 @@
|
||||||
/target
|
### Rust ###
|
||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
target/**
|
||||||
|
|
||||||
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/rust
|
||||||
|
|
|
@ -278,6 +278,9 @@ impl App {
|
||||||
self.export_headers();
|
self.export_headers();
|
||||||
}
|
}
|
||||||
pub fn next(&mut self) {
|
pub fn next(&mut self) {
|
||||||
|
if self.tasks.len() == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
let i = match self.state.selected() {
|
let i = match self.state.selected() {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
if i >= self.tasks.len() - 1 {
|
if i >= self.tasks.len() - 1 {
|
||||||
|
@ -291,6 +294,9 @@ impl App {
|
||||||
self.state.select(Some(i));
|
self.state.select(Some(i));
|
||||||
}
|
}
|
||||||
pub fn previous(&mut self) {
|
pub fn previous(&mut self) {
|
||||||
|
if self.tasks.len() == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
let i = match self.state.selected() {
|
let i = match self.state.selected() {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
|
@ -344,6 +350,7 @@ impl App {
|
||||||
pub fn export_tasks(&mut self) {
|
pub fn export_tasks(&mut self) {
|
||||||
let mut task = Command::new("task");
|
let mut task = Command::new("task");
|
||||||
|
|
||||||
|
task.arg("rc.json.array=on");
|
||||||
task.arg("export");
|
task.arg("export");
|
||||||
|
|
||||||
match split(&self.filter) {
|
match split(&self.filter) {
|
||||||
|
@ -417,6 +424,8 @@ mod tests {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
app.update();
|
app.update();
|
||||||
|
|
||||||
|
println!("{:?}", app.tasks);
|
||||||
|
|
||||||
println!("{:?}", app.task_report_columns);
|
println!("{:?}", app.task_report_columns);
|
||||||
println!("{:?}", app.task_report_labels);
|
println!("{:?}", app.task_report_labels);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue