egui/crates/epaint/src
Juan Campa c630a8de89
Fix incorrect line breaks (#4377)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

While breaking a paragraph, it was possible to lose line break
candidates that could've been used on the next line, causing egui to
unnecessarily overrun `wrap.max_width`.

This PR fixes it so that we don't forget about those candidates.


Before:
Note that the window can't resize to the requested width because the
text is not wrapping.


https://github.com/emilk/egui/assets/1410520/6430a334-2995-4b40-bc34-8f01923f9f95

After:


https://github.com/emilk/egui/assets/1410520/225fa4cd-cbbb-4a7e-9580-7f1814c05ee7

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-04-21 10:58:40 +02:00
..
text Fix incorrect line breaks (#4377) 2024-04-21 10:58:40 +02:00
util Use `Self` everywhere (#3787) 2024-01-08 17:41:21 +01:00
bezier.rs Use `Self` everywhere (#3787) 2024-01-08 17:41:21 +01:00
image.rs Add `ColorImage::from_gray_iter` (#3536) 2024-02-20 15:29:23 +01:00
lib.rs Add `Margin` to `epaint` (#4231) 2024-03-26 09:05:29 +01:00
margin.rs Overload operators for `Rect + Margin`, `Rect - Margin` etc (#4277) 2024-03-30 14:03:41 +01:00
mesh.rs Add layer transforms, interaction in layer (#3906) 2024-02-17 11:02:56 +01:00
mutex.rs Use `impl Into<Stroke>` as argument in a few more places (#3420) 2023-11-10 21:36:51 +01:00
shadow.rs Add `RectShape::blur_width` to implement shadows (#4267) 2024-03-29 20:29:42 +01:00
shape.rs Add `RectShape::blur_width` to implement shadows (#4267) 2024-03-29 20:29:42 +01:00
shape_transform.rs Add `RectShape::blur_width` to implement shadows (#4267) 2024-03-29 20:29:42 +01:00
stats.rs Enforce writing username in TODO comments (#4235) 2024-03-26 11:48:24 +01:00
stroke.rs Use `Self` everywhere (#3787) 2024-01-08 17:41:21 +01:00
tessellator.rs Add `RectShape::blur_width` to implement shadows (#4267) 2024-03-29 20:29:42 +01:00
texture_atlas.rs Fix buggy text withviewports on monitors with different scales (#3666) 2023-11-30 15:56:05 +01:00
texture_handle.rs Improved texture loading (#3315) 2023-09-12 10:39:17 +02:00
textures.rs Add `TextureOptions::wrap_mode` (#3954) 2024-02-05 09:37:05 +01:00