zed icon indicating copy to clipboard operation
zed copied to clipboard

[GPUI] [Windows] Panic with certain Unicode characters DirectWrite

Open MatinAniss opened this issue 10 months ago • 4 comments

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: image

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

MatinAniss avatar Apr 18 '24 23:04 MatinAniss

cc: @JunkuiZhang

mikayla-maki avatar Apr 19 '24 00:04 mikayla-maki

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?

JunkuiZhang avatar Apr 19 '24 00:04 JunkuiZhang

That sounds about right, that should be a control character anyway.

mikayla-maki avatar Apr 19 '24 00:04 mikayla-maki

Thank you very much for your feedbacks. I will submit a PR.

JunkuiZhang avatar Apr 19 '24 00:04 JunkuiZhang