Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TUI: Overflow is not working #58

Open
1 of 3 tasks
George-Miao opened this issue Apr 25, 2022 · 1 comment
Open
1 of 3 tasks

TUI: Overflow is not working #58

George-Miao opened this issue Apr 25, 2022 · 1 comment
Labels
tui Related to dioxus TUI

Comments

@George-Miao
Copy link

Problem

Long text is not hidden or trimmed properly according to overflow attribute, which will cause out-of-boundry panic.

Steps To Reproduce

Code:

fn main() {
    dioxus_tui::launch(|cx| {
        cx.render(rsx!{
            div {
                "overflow": "hidden",
                "------------------------------------------------------------------------------------------------------------------"
            }
        })
    });
}

Expected behavior

Text should be trimmed or wrapped when length is greater than container's width.

Screenshots

image

Environment:

  • Dioxus version: [0.2.3]
  • Rust version: [rustc 1.61.0-nightly (8d60bf427 2022-03-19)]
  • OS info: [Linux]
  • Terminal: [Alacritty]
  • App platform: [tui]

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later
@ealmloff
Copy link
Member

ealmloff commented Apr 25, 2022

Good catch. It looks like the text rendering in https://github.com/DioxusLabs/dioxus/blob/master/packages/tui/src/render.rs#L66 ignores the size of the layout right now. We have code that parses overflow for stretch2 in the attributes file, but stretch2 never uses it. We can add a field for it in the TuiNode for overflow and use it in the renderer.
Edit: stretch allows specifying a measure function we might be able to use for wrapping to allow the changes to effect the rest of the layout

@jkelleyrtp jkelleyrtp transferred this issue from DioxusLabs/dioxus Mar 18, 2024
@ealmloff ealmloff changed the title Overflow is not working TUI: Overflow is not working Mar 18, 2024
@ealmloff ealmloff added the tui Related to dioxus TUI label Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tui Related to dioxus TUI
Projects
None yet
Development

No branches or pull requests

2 participants