Skip to content

--status prints the second line of a multi-line value at column 0, under the labels (including a getter's multi-line exception message) #85

Open

Description

@matt-edmondson

What's wrong

StatusReport.Build writes each row as a single interpolation, with no handling for a value that contains a newline:

report.AppendLine(HelpText.Version(name));
foreach ((string label, string value) in rows)
{
report.AppendLine($"{(label + ':').PadRight(labelWidth)}{value}");
}

report.AppendLine($"{(label + ':').PadRight(labelWidth)}{value}");

When a value contains \n (a .Status(...) string, a StatusDetail getter, or the "error: " + ex.Message text that Read produces for a throwing getter, added in #64), every line after the first starts at column 0. It then sits in the label column and looks like a separate, unlabelled row. --help already handles this case: Cli/HelpText.cs (around lines 131-151) splits a description on \n and indents each continuation line to the value column. --status does neither. #75/#76 fixed the column alignment for one-line values only.

Reproduction

The values below were run through StatusReport.Build in a scratch project:

  • the status "Holding a sleep inhibitor\nsince 10:02"
  • a detail Inhibitors => "systemd-inhibit\ncaffeinate"
  • a getter that throws "systemd-inhibit not found.\nInstall systemd."

Output:

State:         Holding a sleep inhibitor
since 10:02
Inhibitors:    systemd-inhibit
caffeinate
Helper:        error: systemd-inhibit not found.
Install systemd.

Why it matters

--status exists to explain a tool that can't do its job. The most useful text in that situation is often an exception message or a list of helpers, and both commonly span several lines. As it stands, the continuation lines read as rows with no label, and a user can't tell which value they belong to.

Suggested fix / acceptance criteria

  • Split each value on \n, trimming a trailing \r from each line. Write the first line after the padded label and indent every later line by labelWidth spaces, the way HelpText does for --help.
  • This applies to every row: Platform, Tray icon, State, the detail rows, and the error: rows from Read.
  • Add a test: given a multi-line status, a multi-line detail and a getter that throws a multi-line message, every line after a row's first starts with exactly labelWidth spaces, and the report still has no trailing newline.

Activity

  1. matt-edmondson commented on Nov 5, 2026

    @matt-edmondson
    ContributorAuthor

    Triage

    Category: Bug
    Priority: Low. The problem is cosmetic and readability only. Every piece of information is still printed, just misaligned. It matters most for error: rows, though, so it is worth doing alongside other --status work.

    Area / suggested assignment: TrayApp/StatusReport.cs, in Build. This is the --status and CLI output area. Reuse the continuation-indent logic from Cli/HelpText.cs.

    Duplicates / in progress

    Next steps: Split each value on \n and trim any trailing \r. Indent continuation lines by labelWidth, ideally through a helper shared with HelpText. Add the three-case test from the issue, which also asserts there is no trailing newline.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions