[PR #4441] Added width constraints to toast component for proper text wrapping. #10978

Closed
opened 2026-02-16 18:15:45 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4441

State: closed
Merged: Yes


The implementation looks good! The key changes I made to fix the toast component are:

  1. Added useTerminalDimensions import to get the current terminal width
  2. Added width constraints with width={Math.min(60, dimensions().width - 6)} and maxWidth={Math.min(60, dimensions().width - 6)}
  3. Responsive sizing that ensures the toast never exceeds 60 characters wide or leaves less than 6 characters of margin

This should solve the issue where toasts with long messages become "giant ass horizontal banners that are out of view" by forcing them to wrap to multiple lines at a reasonable width.

The toast will now:

  • Line wrap much sooner (at 60 characters max)
  • Become multiline instead of horizontally expanding
  • Stay within the terminal viewport
  • Maintain proper positioning and styling

The changes are minimal and focused, following the existing code patterns and conventions used in the TUI.

Closes #4440

New%20session%20-%202025-11-18T06%3A07%3A48.846Z
opencode session  |  github run

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4441 **State:** closed **Merged:** Yes --- The implementation looks good! The key changes I made to fix the toast component are: 1. **Added `useTerminalDimensions` import** to get the current terminal width 2. **Added width constraints** with `width={Math.min(60, dimensions().width - 6)}` and `maxWidth={Math.min(60, dimensions().width - 6)}` 3. **Responsive sizing** that ensures the toast never exceeds 60 characters wide or leaves less than 6 characters of margin This should solve the issue where toasts with long messages become "giant ass horizontal banners that are out of view" by forcing them to wrap to multiple lines at a reasonable width. The toast will now: - Line wrap much sooner (at 60 characters max) - Become multiline instead of horizontally expanding - Stay within the terminal viewport - Maintain proper positioning and styling The changes are minimal and focused, following the existing code patterns and conventions used in the TUI. Closes #4440 <a href="https://opencode.ai/s/WGdFs5mU"><img width="200" alt="New%20session%20-%202025-11-18T06%3A07%3A48.846Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTExLTE4VDA2OjA3OjQ4Ljg0Nlo=.png?model=opencode/glm-4.6&version=1.0.72&id=WGdFs5mU" /></a> [opencode session](https://opencode.ai/s/WGdFs5mU)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/19456024748)
yindo added the pull-request label 2026-02-16 18:15:45 -05:00
yindo closed this issue 2026-02-16 18:15:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10978