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

Style information is dropped on wrapped lines. #119

Closed
nathanrboyer opened this issue Jun 20, 2022 · 7 comments · Fixed by #188
Closed

Style information is dropped on wrapped lines. #119

nathanrboyer opened this issue Jun 20, 2022 · 7 comments · Fixed by #188
Milestone

Comments

@nathanrboyer
Copy link
Contributor

julia> Panel("{dim}This is some long text.{/dim}")
╭───────────────────────────╮
│  This is some long text.  │ <-- shown dim
╰───────────────────────────╯

julia> Panel("{dim}This is some long text.{/dim}", width=20, fit=false)
╭──────────────────╮
│  This is some    │ <-- shown dim
│  long text.      │ <-- shown normal
╰──────────────────╯
@FedeClaudi
Copy link
Owner

Fix for the next release:
image

As always, you do such a great job of finding bugs! Thank you!

@FedeClaudi
Copy link
Owner

Solved in #124

@nathanrboyer
Copy link
Contributor Author

I'm still getting the same behavior on version 1.0.4. The white text inside the panels is in error.

image

@nathanrboyer
Copy link
Contributor Author

I'm actually not sure why the text is wrapping at all. The panel width should be expanding to fit the text.
The functions for creating those panels are below:

"""
    tableKM620_options()

Returns a terminal panel with the material information from Table KM-620. Call `print` or `println` on the result to diplay it.
"""
function tableKM620_options()
    option_text = RenderableText(join(tableKM620."Material", "\n"), style = "dim")
    option_numbers = RenderableText(join(string.(collect(1:option_text.measure.h)), "\n"), style = "dim")
    vline = vLine(option_numbers, style = "cyan")
    note_text = RenderableText("Ferritic steel includes carbon, low alloy, and alloy steels,\n" *
                                "and ferritic, martensitic, and iron-based age-hardening stainless steels."
                                , style = "dim")
    note_panel = Panel(note_text,
                        title = "Note",
                        style = "cyan")
    top_text = TextBox(option_numbers * " " * vline * " " * option_text,
                        padding = (2, 0, 0, 0))
    options_panel = Panel(top_text / note_panel,
                        title = "Table KM-620 Material Categories",
                        style = "cyan")
    return options_panel
end

"""
    yield_options()

Returns a terminal panel with the yield strain calculation options. Call `print` or `println` on the result to diplay it.
"""
function yield_options()
    option_text = RenderableText("Use ϵₚ from Table KM-620 as the proportional limit tolerance at yield.\n" *
                                "Use 0.2% engineering offset strain as the proportional limit tolerance at yield.\n" *
                                "Specify my own proportional limit tolerance at yield.",
                                style = "dim")
    option_numbers = RenderableText(join(string.(collect(1:option_text.measure.h)), "\n"), style = "dim")
    vline = vLine(option_numbers, style = "cyan")
    options_panel = Panel(option_numbers * " " * vline * " " * option_text,
                            title = "Yield Point Calculation Options",
                            style = "cyan",
                            padding = (5, 5, 1, 1))
    return options_panel
end

@FedeClaudi
Copy link
Owner

Hey, the fit argument of Panel is false by default (this might have changed in recent releases, sorry) (see here).
Have you tried setting fit=true?

@FedeClaudi FedeClaudi reopened this Oct 12, 2022
@nathanrboyer
Copy link
Contributor Author

nathanrboyer commented Oct 12, 2022

Ah, okay. I must have missed that. Setting fit=true fixes the issue for me, but you may still be interested in the style being reset on the wrapped lines above.
image

@FedeClaudi FedeClaudi added this to the v2.0 milestone Dec 6, 2022
@FedeClaudi FedeClaudi linked a pull request Dec 23, 2022 that will close this issue
@FedeClaudi
Copy link
Owner

It took a while but this will be fixed by the next PR

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 a pull request may close this issue.

2 participants