mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 17:57:19 +02:00
Run cargo fmt
This commit is contained in:
parent
1affc4d556
commit
4909e0df33
2 changed files with 39 additions and 30 deletions
27
src/app.rs
27
src/app.rs
|
@ -569,12 +569,7 @@ impl TTApp {
|
||||||
style
|
style
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn calculate_widths(
|
pub fn calculate_widths(&self, tasks: &[Vec<String>], headers: &[String], maximum_column_width: u16) -> Vec<usize> {
|
||||||
&self,
|
|
||||||
tasks: &[Vec<String>],
|
|
||||||
headers: &[String],
|
|
||||||
maximum_column_width: u16,
|
|
||||||
) -> Vec<usize> {
|
|
||||||
// naive implementation of calculate widths
|
// naive implementation of calculate widths
|
||||||
let mut widths = headers.iter().map(|s| s.len()).collect::<Vec<usize>>();
|
let mut widths = headers.iter().map(|s| s.len()).collect::<Vec<usize>>();
|
||||||
|
|
||||||
|
@ -1300,12 +1295,14 @@ impl TTApp {
|
||||||
if task.annotations().is_some() {
|
if task.annotations().is_some() {
|
||||||
add_tag(&mut task, "ANNOTATED".to_string());
|
add_tag(&mut task, "ANNOTATED".to_string());
|
||||||
}
|
}
|
||||||
if task.tags().is_some() && task
|
if task.tags().is_some()
|
||||||
.tags()
|
&& task
|
||||||
.unwrap()
|
.tags()
|
||||||
.iter()
|
.unwrap()
|
||||||
.find(|s| !self.task_report_table.virtual_tags.contains(s))
|
.iter()
|
||||||
.is_some() {
|
.find(|s| !self.task_report_table.virtual_tags.contains(s))
|
||||||
|
.is_some()
|
||||||
|
{
|
||||||
add_tag(&mut task, "TAGGED".to_string());
|
add_tag(&mut task, "TAGGED".to_string());
|
||||||
}
|
}
|
||||||
if task.mask().is_some() {
|
if task.mask().is_some() {
|
||||||
|
@ -1364,7 +1361,11 @@ impl TTApp {
|
||||||
Key::Char('r') => self.update()?,
|
Key::Char('r') => self.update()?,
|
||||||
Key::End | Key::Char('G') => self.task_report_bottom(),
|
Key::End | Key::Char('G') => self.task_report_bottom(),
|
||||||
Key::Home => self.task_report_top(),
|
Key::Home => self.task_report_top(),
|
||||||
Key::Char('g') => if let Event::Input(Key::Char('g')) = events.next()? { self.task_report_top() },
|
Key::Char('g') => {
|
||||||
|
if let Event::Input(Key::Char('g')) = events.next()? {
|
||||||
|
self.task_report_top()
|
||||||
|
}
|
||||||
|
}
|
||||||
Key::Down | Key::Char('j') => self.task_report_next(),
|
Key::Down | Key::Char('j') => self.task_report_next(),
|
||||||
Key::Up | Key::Char('k') => self.task_report_previous(),
|
Key::Up | Key::Char('k') => self.task_report_previous(),
|
||||||
Key::PageDown | Key::Char('J') => self.task_report_next_page(),
|
Key::PageDown | Key::Char('J') => self.task_report_next_page(),
|
||||||
|
|
|
@ -95,16 +95,10 @@ impl Config {
|
||||||
uda_selection_dim: Self::get_uda_selection_dim(),
|
uda_selection_dim: Self::get_uda_selection_dim(),
|
||||||
uda_selection_blink: Self::get_uda_selection_blink(),
|
uda_selection_blink: Self::get_uda_selection_blink(),
|
||||||
uda_calendar_months_per_row: Self::get_uda_months_per_row(),
|
uda_calendar_months_per_row: Self::get_uda_months_per_row(),
|
||||||
uda_style_calendar_title: Self::get_uda_style("calendar.title").unwrap_or_else(|| TColor::new(
|
uda_style_calendar_title: Self::get_uda_style("calendar.title")
|
||||||
Color::Reset,
|
.unwrap_or_else(|| TColor::new(Color::Reset, Color::Reset, vec![])),
|
||||||
Color::Reset,
|
uda_style_context_active: Self::get_uda_style("context.active")
|
||||||
vec![],
|
.unwrap_or_else(|| TColor::new(Color::Reset, Color::Reset, vec![])),
|
||||||
)),
|
|
||||||
uda_style_context_active: Self::get_uda_style("context.active").unwrap_or_else(|| TColor::new(
|
|
||||||
Color::Reset,
|
|
||||||
Color::Reset,
|
|
||||||
vec![],
|
|
||||||
)),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,11 +311,15 @@ impl Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_uda_task_report_show_info() -> bool {
|
fn get_uda_task_report_show_info() -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.task-report.show-info").get_bool().unwrap_or(true)
|
Self::get_config("uda.taskwarrior-tui.task-report.show-info")
|
||||||
|
.get_bool()
|
||||||
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_uda_task_report_looping() -> bool {
|
fn get_uda_task_report_looping() -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.task-report.looping").get_bool().unwrap_or(true)
|
Self::get_config("uda.taskwarrior-tui.task-report.looping")
|
||||||
|
.get_bool()
|
||||||
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_uda_selection_indicator() -> String {
|
fn get_uda_selection_indicator() -> String {
|
||||||
|
@ -334,23 +332,33 @@ impl Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_uda_selection_bold() -> bool {
|
fn get_uda_selection_bold() -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.selection.bold").get_bool().unwrap_or(true)
|
Self::get_config("uda.taskwarrior-tui.selection.bold")
|
||||||
|
.get_bool()
|
||||||
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_uda_selection_italic() -> bool {
|
fn get_uda_selection_italic() -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.selection.italic").get_bool().unwrap_or(false)
|
Self::get_config("uda.taskwarrior-tui.selection.italic")
|
||||||
|
.get_bool()
|
||||||
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_uda_selection_dim() -> bool {
|
fn get_uda_selection_dim() -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.selection.dim").get_bool().unwrap_or(false)
|
Self::get_config("uda.taskwarrior-tui.selection.dim")
|
||||||
|
.get_bool()
|
||||||
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_uda_selection_blink() -> bool {
|
fn get_uda_selection_blink() -> bool {
|
||||||
Self::get_config("uda.taskwarrior-tui.selection.blink").get_bool().unwrap_or(false)
|
Self::get_config("uda.taskwarrior-tui.selection.blink")
|
||||||
|
.get_bool()
|
||||||
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_uda_months_per_row() -> usize {
|
fn get_uda_months_per_row() -> usize {
|
||||||
Self::get_config("uda.taskwarrior-tui.calendar.months-per-row").parse::<usize>().unwrap_or(4)
|
Self::get_config("uda.taskwarrior-tui.calendar.months-per-row")
|
||||||
|
.parse::<usize>()
|
||||||
|
.unwrap_or(4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue