zed
zed copied to clipboard
[GPUI] [Windows] Panic with certain Unicode characters DirectWrite
Check for existing issues
- [x] Completed
Describe the bug / provide steps to reproduce it
GPUI panics when rendering some Unicode characters, a example is \u0001
.
It seems as glyph_count
is 0
in this case which causes the divide by zero panic.
Error:
thread 'main' panicked at C:\Users\Matin\.cargo\git\checkouts\zed-23861290b5d2093f\dd7eced\crates\gpui\src\platform\windows\direct_write.rs:933:42: attempt to divide by zero
Example:
Environment
Zed: v0.133.0 (Zed Dev 95827d4c49d290bcb56093e7476360b4c60a0075) OS: Windows 10.0.22631 Memory: 31.1 GiB Architecture: x86_64
If applicable, attach your ~/Library/Logs/Zed/Zed.log
file to this issue.
No response
cc: @JunkuiZhang
I attempted a fix where the behavior will be consistent with the text system implementation on the macOS platform. As a result, \u{0001}
will not be rendered.. Is this fix acceptable?
That sounds about right, that should be a control character anyway.
Thank you very much for your feedbacks. I will submit a PR.