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

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

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

joshka
Copy link
Member

@joshka joshka commented Jun 19, 2024

Line::from("a\nb") now returns a line with two Spans instead of 1
Fixes: #1111

`Line::from("a\nb")` now returns a line with two `Span`s instead of 1
Fixes: #1111
@joshka
Copy link
Member Author

joshka commented Jun 19, 2024

Unsure whether to mark this as breaking - thoughts?

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@           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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joshka joshka added the Status: Review Needed PR needs a review / Issue needs buy-in from other maintainers / users label Jun 19, 2024
@kdheepak
Copy link
Collaborator

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
Copy link
Member Author

joshka commented Jun 19, 2024

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.

@joshka joshka merged commit efa965e into main Jun 19, 2024
36 checks passed
@joshka joshka deleted the jm/fix-line-split branch June 19, 2024 04:35
itsjunetime pushed a commit to itsjunetime/ratatui that referenced this pull request Jun 23, 2024
…1191)

`Line::from("a\nb")` now returns a line with two `Span`s instead of 1
Fixes: ratatui#1111
@joshka joshka removed the Status: Review Needed PR needs a review / Issue needs buy-in from other maintainers / users label Jun 25, 2024
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 this pull request may close these issues.

Inconsistent behavior between Line::from and Line::raw
2 participants