Skip to content
This repository was archived by the owner on Aug 6, 2023. It is now read-only.
This repository was archived by the owner on Aug 6, 2023. It is now read-only.

Version 0.10: Spans can't contain line-breaks #339

@TheLostLambda

Description

@TheLostLambda

Describe the bug
I understand that multiple lines in a paragraph are intended to be represented using Text, but I seem unable to apply a span over several lines which I think is still very useful.

To Reproduce
Using the current development version from Git, I'm ultimately building the following:

[src/console/render.rs:58] vec![Spans :: from(text), Spans :: from("This is on the second line...")] = [
    Spans(
        [
            Span {
                content: "To Kill a Mockingbird\n",
                style: Style {
                    fg: None,
                    bg: None,
                    add_modifier: ITALIC,
                    sub_modifier: (empty),
                },
            },
            Span {
                content: "*noun*\n   1) outfit, equipment, attire\n\n",
                style: Style {
                    fg: None,
                    bg: None,
                    add_modifier: BOLD,
                    sub_modifier: (empty),
                },
            },
            Span {
                content: "1) obstreperous\n",
                style: Style {
                    fg: None,
                    bg: None,
                    add_modifier: (empty),
                    sub_modifier: (empty),
                },
            },
            Span {
                content: "2) invective\n",
                style: Style {
                    fg: None,
                    bg: None,
                    add_modifier: (empty),
                    sub_modifier: (empty),
                },
            },
            Span {
                content: "3) habiliment\n",
                style: Style {
                    fg: None,
                    bg: None,
                    add_modifier: (empty),
                    sub_modifier: (empty),
                },
            },
            Span {
                content: "4) furore\n",
                style: Style {
                    fg: None,
                    bg: None,
                    add_modifier: (empty),
                    sub_modifier: (empty),
                },
            },
        ],
    ),
    Spans(
        [
            Span {
                content: "This is on the second line...",
                style: Style {
                    fg: None,
                    bg: None,
                    add_modifier: (empty),
                    sub_modifier: (empty),
                },
            },
        ],
    ),
]

Which results in the following (note that all of my \n's were ignored):

To Kill a Mockingbird*noun*   1) outfit, equipment, attire1) obstreperous2)   
invective3) habiliment4) furore                                               
This is on the second line...      

Expected behavior

I'm really looking for what I had before the text refactoring:

To Kill a Mockingbird
*noun*
   1) outfit, equipment, attire

1) obstreperous
2) invective
3) habiliment
4) furore                                               
This is on the second line...      

Desktop:

  • OS: Linux
  • Terminal Emulator: gnome-terminal
  • Font: IBM Plex Mono
  • Crate version:
name = "tui"
version = "0.9.5"
source = "git+https://github.com/fdehau/tui-rs.git#6b52c91257f9073e4fe913f15bee0716b45dfd0d"
  • Backend: crossterm

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions