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

bug: Preformatted text wrapping in nested tables causes assertion error. #187

Closed
JadedBlueEyes opened this issue Nov 22, 2024 · 2 comments · Fixed by #188
Closed

bug: Preformatted text wrapping in nested tables causes assertion error. #187

JadedBlueEyes opened this issue Nov 22, 2024 · 2 comments · Fixed by #188

Comments

@JadedBlueEyes
Copy link
Contributor

Minimal reproduction:
It seems that a specific combination of nested tables combined with a preformatted text element causes a panic.

        let html = br#"<div><table><tbody><tr><td><div><table><tbody><tr><td><div><p class="pre">na na na na na na na na na na na na na na na</p></div></td></tr>/<tbody></table></div></td></tr>/<tbody></table></div>"#;
        let _ = crate::config::plain().add_css(r#".pre { white-space: pre; }"#)
        .unwrap()
        .string_from_read(&html[..], 17);
thread 'tests::css_tests::test_pre_no_wrap' panicked at src\render\text_renderer.rs:302:9:
assertion `left == right` failed
  left: 17
 right: 16
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

For now I am working around this by enabling raw mode.

@jugglerchris
Copy link
Owner

Thanks for the test case!
#188 should fix it - I'll try to do a release soon with the fix.
FWIW the error is a debug assertion - it may all work fine in a release build.

@JadedBlueEyes
Copy link
Contributor Author

Thanks for the snappy fix!

Good to know that it's a debug assert. Conveniently for me raw mode produces better output in my particular case!

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 a pull request may close this issue.

2 participants