-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
feat(line): add Line::raw
constructor
#511
Conversation
There is already `Span::raw` and `Text::raw` methods and this commit simply adds `Line::raw` method for symmetry.
Question: should we break newlines into different spans? e.g. |
Codecov Report
@@ Coverage Diff @@
## main #511 +/- ##
==========================================
+ Coverage 89.93% 90.06% +0.13%
==========================================
Files 41 40 -1
Lines 11334 11267 -67
==========================================
- Hits 10193 10148 -45
+ Misses 1141 1119 -22
|
There are a few ways we could handle newlines in
Option 3 makes most sense to me, but Option 1 is also possible. Option 2 allocates new memory, but is probably a reasonable approach and "performant enough" except for massive strings. Option 4 is a pretty terrible one. |
I think I have some naming + semantic questions about what we want From Wiki
Do they make 3 lines to convert them to a |
I think @joshka's 3rd option makes the most sense. If everyone agrees then I can update the PR. |
I think it's reasonable that Line would have a
3 lines So at the least for consistency, Line should ever have a newline character. This also avoids having every widget that takes a line parameter have to work manually handle it (e.g. what should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add newline handling ("a\nb"
becomes Line::from(vec![Span::raw("a"), Span::raw("b")])
)
Updated in 9d4db84 |
closes #508