Skip to content

fix(tui): truncateMiddle returns the whole string when maxLength is 1 or 2 - #34342

Closed
Osamaali313 wants to merge 1 commit into
anomalyco:devfrom
Osamaali313:fix/truncate-middle-small-widths
Closed

Osamaali313 wants to merge 1 commit into
anomalyco:devfrom
Osamaali313:fix/truncate-middle-small-widths

Conversation

@Osamaali313

Copy link
Copy Markdown

At maxLength 1 or 2, keepEnd is 0 and str.slice(-0) returns the entire string, so truncateMiddle returns output longer than its input (e.g. the run splash detail line overflows on very narrow terminals). Fix: skip the end slice when keepEnd is 0. Added a unit test for the small-width cases.

keepEnd is 0 at those widths, and str.slice(-0) returns the entire string, so truncateMiddle produced output longer than the input (e.g. the run splash detail line overflows on narrow terminals). Skip the end slice when keepEnd is 0.
Copilot AI review requested due to automatic review settings June 28, 2026 20:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

The search found one related PR (#32470 "fix(tui): truncate labels by display width") which addresses a different truncation concern, but it is not a duplicate of PR #34342. PR #34342 is specifically fixing a bug in the truncateMiddle function when maxLength is 1 or 2, while #32470 appears to focus on truncating labels by display width—a different aspect of string truncation.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 28, 2026
@github-actions github-actions Bot closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants