ratatui-org / ratatui

Rust library that's all about cooking up terminal user interfaces (TUIs) šŸ‘Øā€šŸ³šŸ€
https://ratatui.rs
MIT License
8.82k stars 263 forks source link

fix(line): remove newlines when converting strings to Lines #1191

Closed joshka closed 2 weeks ago

joshka commented 2 weeks ago

Line::from("a\nb") now returns a line with two Spans instead of 1 Fixes: https://github.com/ratatui-org/ratatui/issues/1111

joshka commented 2 weeks ago

Unsure whether to mark this as breaking - thoughts?

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.4%. Comparing base (127d706) to head (133771c).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1191 +/- ## ======================================= - Coverage 94.4% 94.4% -0.1% ======================================= Files 62 62 Lines 14935 14941 +6 ======================================= + Hits 14105 14110 +5 - Misses 830 831 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kdheepak commented 2 weeks ago

In my opinion this is a bug and should not be considered breaking. Iā€™d be surprised if someone intentionally were relying on this behavior. I think the issue is that if someone were unwittingly relying on this behavior, would they understand it is a bug or be frustrated that their code broke in a minor release? I personally lean toward the former.

joshka commented 2 weeks ago

Yeah, me too.I'm wary based on a recent similar assertion in unicode-width, where they changed behavior in a point release and which broke our tests. This will go out in 0.27.0, so it's in a release that can break things. I'm just unsure whether to document it as such or if the commit is enough here. We can always backfill the BREAKING CHANGES doc if needed on this.