-
Notifications
You must be signed in to change notification settings - Fork 31
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
Crash with no text in layout and very small widths #186
Labels
bug
Something isn't working
Comments
DJMcNab
added a commit
to DJMcNab/xilem
that referenced
this issue
Nov 28, 2024
DJMcNab
added a commit
to DJMcNab/xilem
that referenced
this issue
Nov 28, 2024
github-merge-queue bot
pushed a commit
to linebender/xilem
that referenced
this issue
Nov 28, 2024
The upstream PR has now been merged: linebender/parley#170 I've had to add a hack to workaround linebender/parley#186. This occurs because of the first pass of layout with zero available area.
The following patch fixes the crash for me, but causes the cursor position in an empty layout to display as if there was a line-break (it's on the "second line"): diff --git a/parley/src/layout/line/greedy.rs b/parley/src/layout/line/greedy.rs
index 967df61..1c8e89e 100644
--- a/parley/src/layout/line/greedy.rs
+++ b/parley/src/layout/line/greedy.rs
@@ -759,7 +759,7 @@ fn try_commit_line<B: Brush>(
// Push run to line
let run = Run::new(layout, 0, 0, run_data, None);
- let text_range = if run_data.cluster_range.is_empty() {
+ let text_range = if cluster_range.is_empty() {
0..0
} else {
let first_cluster = run |
The
|
github-merge-queue bot
pushed a commit
that referenced
this issue
Dec 3, 2024
- Fixes #186 I don't really understand why this works (why it crashes with a smaller width but not a larger one in the first place) But seeing as the `max_advance` doesn't really makes any difference for "empty" layouts that only contain a single space, it seems safe to ignore it here. Signed-off-by: Nico Burns <[email protected]>
DJMcNab
added a commit
to DJMcNab/parley
that referenced
this issue
Dec 4, 2024
DJMcNab
added a commit
to DJMcNab/parley
that referenced
this issue
Dec 4, 2024
Remove workaround for linebender#186 Use `unchecked` name Fix doc comment Restore debug code Remove comment from Masonry Co-Authored-By: Tom Churchman <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To reproduce, you can apply this patch then select all and press backspace or delete:
Patch to reproduce
On my machine, any width less than an unknown value in [3.52, 3.521) causes a crash. The backtrace is:
Backtrace
And therefore the offending unwrap is:
parley/parley/src/layout/line/greedy.rs
Lines 765 to 767 in c0d158b
The text was updated successfully, but these errors were encountered: