Text and Boxes need flexShrink=0 where they should not shrink #2497

Closed
opened 2026-02-16 17:35:57 -05:00 by yindo · 16 comments
Owner

Originally created by @ravshansbox on GitHub (Nov 2, 2025).

Originally assigned to: @thdxr on GitHub.

Description

Sometimes it incorrectly chooses start column when rendering (or rerendering) tasks list

Image

OpenCode version

1.0.12

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 26.0.1

Terminal

No response

Originally created by @ravshansbox on GitHub (Nov 2, 2025). Originally assigned to: @thdxr on GitHub. ### Description Sometimes it incorrectly chooses start column when rendering (or rerendering) tasks list <img width="374" height="896" alt="Image" src="https://github.com/user-attachments/assets/62ebf71e-7364-4aae-8b5a-fd9507f39aec" /> ### OpenCode version 1.0.12 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System macOS 26.0.1 ### Terminal _No response_
yindo added the help-wantedopentuibuggood first issue labels 2026-02-16 17:35:57 -05:00
yindo closed this issue 2026-02-16 17:35:57 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 2, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3423: Also relates to todo/task list display problems in OpenTUI
  • #3650: Similar spacing/padding glitches that affect element positioning in TUI sessions
  • #3697: Display positioning issues that occur after window resizing in OpenTUI

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 2, 2025): This issue might be a duplicate of existing issues. Please check: - #3423: Also relates to todo/task list display problems in OpenTUI - #3650: Similar spacing/padding glitches that affect element positioning in TUI sessions - #3697: Display positioning issues that occur after window resizing in OpenTUI Feel free to ignore if none of these address your specific case.
Author
Owner

@thdxr commented on GitHub (Nov 2, 2025):

lots of artifacts there but not sure what's going on

@thdxr commented on GitHub (Nov 2, 2025): lots of artifacts there but not sure what's going on
Author
Owner

@veracioux commented on GitHub (Nov 2, 2025):

@thdxr @kommander When there's not enough space to go around, it seems that flex gaps, margins etc are not honored, and some elements (like <text>) get collapsed. This o here is actually part of Todo which got hidden due to lack of vertical space. But I'm guessing the renderer didn't issue the correct ANSI sequence to explicitly delete that o, and since no other text (or background color) took its place it just remained displayed.

Image
@veracioux commented on GitHub (Nov 2, 2025): @thdxr @kommander When there's not enough space to go around, it seems that flex gaps, margins etc are not honored, and some elements (like `<text>`) get collapsed. This **o** here is actually part of **Todo** which got hidden due to lack of vertical space. But I'm guessing the renderer didn't issue the correct ANSI sequence to explicitly delete that **o**, and since no other text (or background color) took its place it just remained displayed. <img width="515" height="103" alt="Image" src="https://github.com/user-attachments/assets/dbeb06ab-ffc8-4398-ba3d-39aa415fe157" />
Author
Owner

@kommander commented on GitHub (Nov 2, 2025):

What terminal is this? Looks like a grapheme width issue, the checkmark is just one cell, in many other terminals/fonts the checkmark is two cells, so the width calculation for the grapheme is off. What is the Unicode/raw by sequence for that checkmark?

Edit: Is there a message before this one that has any emojis/CJK chars?

@kommander commented on GitHub (Nov 2, 2025): What terminal is this? Looks like a grapheme width issue, the checkmark is just one cell, in many other terminals/fonts the checkmark is two cells, so the width calculation for the grapheme is off. What is the Unicode/raw by sequence for that checkmark? Edit: Is there a message before this one that has any emojis/CJK chars?
Author
Owner

@veracioux commented on GitHub (Nov 2, 2025):

@kommander Don't think this has anything to do with grapheme width necessarily. Check this out (pay attention to the Context text):

https://github.com/user-attachments/assets/7f51f1ea-2f29-40be-a744-bc2ae18f7429

After I modfiy the code to set a background color on the XX,XXX tokens text, it doesn't show up anymore:

https://github.com/user-attachments/assets/97cec708-d9fd-47d8-9e0b-8b690cca8e16

I don't see any special characters being rendered there: https://github.com/veracioux/opencode/blob/9fd672a1cb735eb7f8ec80ffbe9d7540e4687759/packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx#L52

This further confirms https://github.com/sst/opencode/issues/3775#issuecomment-3478404067 I think.

@veracioux commented on GitHub (Nov 2, 2025): @kommander Don't think this has anything to do with grapheme width necessarily. Check this out (pay attention to the **Context** text): https://github.com/user-attachments/assets/7f51f1ea-2f29-40be-a744-bc2ae18f7429 After I modfiy the code to set a background color on the `XX,XXX tokens` text, it doesn't show up anymore: https://github.com/user-attachments/assets/97cec708-d9fd-47d8-9e0b-8b690cca8e16 I don't see any special characters being rendered there: https://github.com/veracioux/opencode/blob/9fd672a1cb735eb7f8ec80ffbe9d7540e4687759/packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx#L52 This further confirms https://github.com/sst/opencode/issues/3775#issuecomment-3478404067 I think.
Author
Owner

@kommander commented on GitHub (Nov 2, 2025):

Ahh now I see what you mean. Okay that is curious. So by default all renderable yoga nodes are flexShrink = 1, so to avoid text nodes getting smashed into each other we can set flexShrink = 0 on the containers for the nodes. Then the container does not shrink and the text nodes do not overlap.

@kommander commented on GitHub (Nov 2, 2025): Ahh now I see what you mean. Okay that is curious. So by default all renderable yoga nodes are `flexShrink = 1`, so to avoid text nodes getting smashed into each other we can set `flexShrink = 0` on the <box> containers for the <text> nodes. Then the container does not shrink and the text nodes do not overlap.
Author
Owner

@OpeOginni commented on GitHub (Nov 5, 2025):

@kommander Hello, I am looking at this issue, is there any point where we would want the sidebar to be scrollable, if the window is a bit small to contain it all?

@OpeOginni commented on GitHub (Nov 5, 2025): @kommander Hello, I am looking at this issue, is there any point where we would want the sidebar to be scrollable, if the window is a bit small to contain it all?
Author
Owner

@veracioux commented on GitHub (Nov 5, 2025):

My 2 cents: I think the Modified Files and Todo sections would benefit from a scrollbox because their contents can get large for long sessions

@veracioux commented on GitHub (Nov 5, 2025): My 2 cents: I think the **Modified Files** and **Todo** sections would benefit from a scrollbox because their contents can get large for long sessions
Author
Owner

@OpeOginni commented on GitHub (Nov 5, 2025):

@veracioux For that I think they should have a fixed height, I can add that, but what I currently have made the whole sidebar scrollable if the window gets small.

https://github.com/user-attachments/assets/9b9feabc-44dd-46d5-9dd4-32b6167411bb

@OpeOginni commented on GitHub (Nov 5, 2025): @veracioux For that I think they should have a fixed height, I can add that, but what I currently have made the whole sidebar scrollable if the window gets small. https://github.com/user-attachments/assets/9b9feabc-44dd-46d5-9dd4-32b6167411bb
Author
Owner

@rekram1-node commented on GitHub (Nov 5, 2025):

I kinda like that, that's cool

@rekram1-node commented on GitHub (Nov 5, 2025): I kinda like that, that's cool
Author
Owner

@kommander commented on GitHub (Nov 5, 2025):

Scrollbox makes sense and would solve the shrinking issue as well

@kommander commented on GitHub (Nov 5, 2025): Scrollbox makes sense and would solve the shrinking issue as well
Author
Owner

@OpeOginni commented on GitHub (Nov 5, 2025):

Cool, Just doing some testing, then Ill get this PR out 🫡

@OpeOginni commented on GitHub (Nov 5, 2025): Cool, Just doing some testing, then Ill get this PR out 🫡
Author
Owner

@thdxr commented on GitHub (Nov 5, 2025):

nice

@thdxr commented on GitHub (Nov 5, 2025): nice
Author
Owner

@OpeOginni commented on GitHub (Nov 9, 2025):

Want to get feedback on this. Was thinking of collapsable items in the sidebar, is it needed?

https://github.com/user-attachments/assets/36dc39b9-1946-480c-a58b-369f65cfa6c5

More of design decision

@OpeOginni commented on GitHub (Nov 9, 2025): Want to get feedback on this. Was thinking of collapsable items in the sidebar, is it needed? https://github.com/user-attachments/assets/36dc39b9-1946-480c-a58b-369f65cfa6c5 More of design decision
Author
Owner

@thdxr commented on GitHub (Nov 11, 2025):

i like it would want to play with some of the styling/icon but i'd take a PR

@thdxr commented on GitHub (Nov 11, 2025): i like it would want to play with some of the styling/icon but i'd take a PR
Author
Owner

@OpeOginni commented on GitHub (Nov 12, 2025):

i like it would want to play with some of the styling/icon but i'd take a PR

Yeah, was thinking of making use of some icons from the opencode/ui package making it similar to the Desktop one.

@OpeOginni commented on GitHub (Nov 12, 2025): > i like it would want to play with some of the styling/icon but i'd take a PR Yeah, was thinking of making use of some icons from the `opencode/ui` package making it similar to the Desktop one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2497