Skip to content

Commit a07c376

Browse files
author
ComputelessComputer
committed
show task ID in checklist items
1 parent 2a8a528 commit a07c376

1 file changed

Lines changed: 57 additions & 31 deletions

File tree

src/main.rs

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4832,51 +4832,77 @@ fn render_checklist_tab(stdout: &mut Stdout, app: &App, cols: u16, rows: u16) ->
48324832
let due_display = clamp_text(&due_str, due_col_w);
48334833
let bucket_display = clamp_text(&task.bucket, bucket_col_w);
48344834

4835+
let short_id = task.id.to_string().chars().take(8).collect::<String>();
4836+
let id_col_w = 9;
48354837
let fixed_cols =
4836-
expand_icon.width() + checkbox.len() + 1 + 2 + due_col_w + 2 + bucket_col_w;
4838+
expand_icon.width() + checkbox.len() + 1 + id_col_w + 2 + due_col_w + 2 + bucket_col_w;
48374839
let title_max = content_width.saturating_sub(fixed_cols + 1);
48384840
let title = clamp_text(&task.title, title_max);
48394841
let title_pad = title_max.saturating_sub(title.width());
48404842
let due_pad = due_col_w.saturating_sub(due_display.width());
48414843
let _bucket_pad = bucket_col_w.saturating_sub(bucket_display.width());
48424844
queue!(stdout, MoveTo(x, y))?;
48434845
if is_sel && app.focus == Focus::Board {
4846+
let line = format!(
4847+
"{}{} {} {}{}{}{}{}{}",
4848+
expand_icon,
4849+
checkbox,
4850+
short_id,
4851+
title,
4852+
" ".repeat(title_pad),
4853+
" ",
4854+
due_display,
4855+
" ".repeat(due_pad.saturating_sub(0) + 2),
4856+
bucket_display,
4857+
);
48444858
queue!(
48454859
stdout,
48464860
SetForegroundColor(Color::Black),
4847-
SetBackgroundColor(Color::White)
4861+
SetBackgroundColor(Color::White),
4862+
Print(pad_to_width(
4863+
&clamp_text(&line, content_width),
4864+
content_width
4865+
)),
4866+
ResetColor
48484867
)?;
4849-
} else if task.progress == Progress::Done {
4850-
queue!(stdout, SetForegroundColor(Color::DarkGrey))?;
48514868
} else {
4852-
let status_color = match task.progress {
4853-
Progress::InProgress => Color::Yellow,
4854-
Progress::Todo => Color::Blue,
4855-
Progress::Backlog => Color::DarkGrey,
4856-
Progress::Archived => Color::DarkGrey,
4857-
Progress::Done => Color::Green,
4869+
let prefix = format!("{}{} ", expand_icon, checkbox);
4870+
let id_str = format!("{} ", short_id);
4871+
let rest = format!(
4872+
"{}{}{}{}{}{}",
4873+
title,
4874+
" ".repeat(title_pad),
4875+
" ",
4876+
due_display,
4877+
" ".repeat(due_pad.saturating_sub(0) + 2),
4878+
bucket_display,
4879+
);
4880+
let rest_padded = pad_to_width(
4881+
&rest,
4882+
content_width.saturating_sub(prefix.width() + id_str.width()),
4883+
);
4884+
let status_color = if task.progress == Progress::Done {
4885+
Color::DarkGrey
4886+
} else {
4887+
match task.progress {
4888+
Progress::InProgress => Color::Yellow,
4889+
Progress::Todo => Color::Blue,
4890+
Progress::Backlog => Color::DarkGrey,
4891+
Progress::Archived => Color::DarkGrey,
4892+
Progress::Done => Color::Green,
4893+
}
48584894
};
4859-
queue!(stdout, SetForegroundColor(status_color))?;
4860-
}
4861-
let line = format!(
4862-
"{}{} {}{}{}{}{}{}",
4863-
expand_icon,
4864-
checkbox,
4865-
title,
4866-
" ".repeat(title_pad),
4867-
" ",
4868-
due_display,
4869-
" ".repeat(due_pad.saturating_sub(0) + 2),
4870-
bucket_display,
4871-
);
4872-
queue!(
4873-
stdout,
4874-
Print(pad_to_width(
4875-
&clamp_text(&line, content_width),
4876-
content_width
4877-
)),
4878-
ResetColor
4879-
)?;
4895+
queue!(
4896+
stdout,
4897+
SetForegroundColor(status_color),
4898+
Print(&prefix),
4899+
SetForegroundColor(Color::DarkGrey),
4900+
Print(&id_str),
4901+
SetForegroundColor(status_color),
4902+
Print(&rest_padded),
4903+
ResetColor
4904+
)?;
4905+
}
48804906
}
48814907
// help line
48824908
queue!(

0 commit comments

Comments
 (0)