Skip to content

ls plain text output columns misalign for long filenames or owner names #22

@github-actions

Description

@github-actions

Description

In tools/ls/ls.go, writePlain uses hardcoded format widths (%-10s, %8s). For entries with long owner names, long filenames, or large file sizes, columns fall out of alignment.

Steps to Reproduce

  1. Create a directory with files owned by a user with a long username
  2. Run aict ls . --plain
  3. Observe misaligned columns

Expected Behavior

Column widths should be computed dynamically based on the longest value per column, matching GNU ls -l behavior.

Implementation Approach

  1. First pass: collect all entries and compute maxOwnerLen, maxGroupLen, maxSizeLen
  2. Second pass: format output using computed widths

Actual Behavior

Fixed-width columns cause visual misalignment when any value exceeds the hardcoded width.

Related

tools/ls/ls.go writePlain function

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions