Skip to content

enhance(cli): Fit conversation ls table to terminal width#703

Merged
JeanMertz merged 1 commit into
mainfrom
prr266
May 29, 2026
Merged

enhance(cli): Fit conversation ls table to terminal width#703
JeanMertz merged 1 commit into
mainfrom
prr266

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

The box table rendered by jp conversation ls could overflow the terminal when conversation titles were long, mangling the box-drawing borders and making the output hard to read.

The command now reads the terminal width at startup (stored as ctx.term.width, None when stdout is piped) and uses it to decide how to handle the title column before rendering. It first probes the table at full width, then compares the rendered width against the terminal. If the table overflows, the title is truncated to the remaining budget; if even a header-width column would overflow, the title column is dropped entirely. Piped and JSON output are unaffected and always receive full titles.

Unicode display widths are computed via unicode-width, and ANSI colour codes plus OSC 8 hyperlinks are stripped before measuring so that invisible bytes do not distort the fit calculation.

The box table rendered by `jp conversation ls` could overflow the
terminal when conversation titles were long, mangling the box-drawing
borders and making the output hard to read.

The command now reads the terminal width at startup (stored as
`ctx.term.width`, `None` when stdout is piped) and uses it to decide how
to handle the title column before rendering. It first probes the table
at full width, then compares the rendered width against the terminal. If
the table overflows, the title is truncated to the remaining budget; if
even a header-width column would overflow, the title column is dropped
entirely. Piped and JSON output are unaffected and always receive full
titles.

Unicode display widths are computed via `unicode-width`, and ANSI colour
codes plus OSC 8 hyperlinks are stripped before measuring so that
invisible bytes do not distort the fit calculation.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit b7218ee into main May 29, 2026
16 checks passed
@JeanMertz JeanMertz deleted the prr266 branch May 29, 2026 23:42
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 this pull request may close these issues.

1 participant