Skip to content

Align task list output for improved readability #575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yzx9 opened this issue Apr 22, 2025 · 0 comments · May be fixed by #576
Open

Align task list output for improved readability #575

yzx9 opened this issue Apr 22, 2025 · 0 comments · May be fixed by #576

Comments

@yzx9
Copy link

yzx9 commented Apr 22, 2025

Problem

The current output of todo list is not column-aligned, making it harder to scan visually — especially when working with long lists or variable-width fields like:

  • Task ID
  • Priority (!, !!, etc.)
  • Date/time (particularly when humanize is enabled)

Example (content hidden for clarity):

[ ]  9  ! 2025-04-23 ...
[ ] 16 !! 2025-04-25 ...
[ ]  4  ! 2025-04-23 ...

Misaligned fields make it more difficult to quickly compare tasks.

Goal

Make the output easier to read by aligning the key fields: ID, priority, and date/time.

Proposed Solutions

Option 1: Fully automatic alignment

  • How: Read all rows first to determine the max width of each field before formatting output.
  • Pros: Cleanest and most flexible — adapts perfectly to the actual data.
  • Cons: Requires two passes — one to measure, one to render. However, this overhead is negligible in practice, as we're already assuming the data set is small enough to fit in stdout.

Option 2: Field-specific width estimation (no full scan)

  • How: Avoid reading all lines by estimating widths per field:
    • ID: Only need the max task ID.
    • Priority: Assume a max width (e.g. 3 chars: !!!).
    • Datetime: The width of formatted or humanized datetime can be calculated from the format string.
  • Pros: Single-pass output, more efficient.
  • Cons: Slight risk of over/under-aligning in edge cases (e.g. if importance ever exceeds assumed width).

I’m happy to help implement this if there's interest in improving the task list formatting.

@yzx9 yzx9 linked a pull request Apr 25, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant