Term.jl
Term.jl copied to clipboard
Style information is dropped on wrapped lines.
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
╰──────────────────╯
Fix for the next release:
As always, you do such a great job of finding bugs! Thank you!
Solved in https://github.com/FedeClaudi/Term.jl/pull/124
I'm still getting the same behavior on version 1.0.4. The white text inside the panels is in error.
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
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
?
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.
It took a while but this will be fixed by the next PR