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

lineLimit appears to have no effect with newline characters #25

Open
markst opened this issue Sep 12, 2024 · 1 comment
Open

lineLimit appears to have no effect with newline characters #25

markst opened this issue Sep 12, 2024 · 1 comment

Comments

@markst
Copy link

markst commented Sep 12, 2024

Some of my response JSON includes strings which contain carriage return (\r) followed by a newline (\n) characters.

  - some : "Songs for Swinging Subversives\r\n\r\nComical intervention on both sides by Vivian Stanshall....\r\nFrom Sir Henry at Ralinson End\"\r\n\r\nA Subtle Subversion Production...\r\n\r\nMixtape given to Paul McKee by Andrew. Reproduced by Stephen Hoare. Photo by Claire Doll"

Despite MarqueeText using .lineLimit(1) and my implementation the same:

MarqueeText(
    text: player.title,
    font: .systemFont(ofSize: 24, weight: .medium),
    leftFade: 10,
    rightFade: 10,
    startDelay: 3,
    alignment: .center
)
.allowsTightening(true)
.lineLimit(1)

My views appear to overflow:

@markst
Copy link
Author

markst commented Sep 12, 2024

Replacing these characters will fix it for me:

content = download.content?
    .components(separatedBy: CharacterSet(charactersIn: "\r\n"))
    .joined() ?? ""

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

No branches or pull requests

1 participant