-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[epaint] Add more text wrapping options #1291
Conversation
d435431
to
5207e51
Compare
Very good. I want to use it. Can you add wrapping by char (no by word) for small textareas? |
For If you mean the latter, |
9c8f906
to
4092f9a
Compare
Pulled this into my fork and it works like a charm, at least in my use case. Thank you! |
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.
Left some comments, but looks good!
epaint/src/text/text_layout_types.rs
Outdated
/// Set to `0` to disable this. | ||
pub max_lines: usize, |
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.
I think usize::MAX
is a better way to disable it; then there is no need for any special cases.
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.
Default was initially usize::MAX
, but I then later realized that if it's set to 0
, then egui crashes in rows_from_paragraphs
because we end up with no paragraphs, hence the check in line_break
function.
a6b4809
to
34e0e36
Compare
Otherwise, we crash in `rows_from_paragraphs`
So people have a place to copy `…` from, which is what most will probably want to use.
34e0e36
to
bb21718
Compare
Using `max_rows == 0` as a special case was a bad idea.
Fix text layout bug added in #1291
Add an ability to limit how many lines the text should have,
control breaking behavior a little bit,
and insert arbitrary character, e.g.
…
, to represent clipped text.Maybe
TextWrapping::overflow_character
should be renamed into something more descriptive, likeoverflow_representation
?out.mp4