# gpui_wgpu: Fix bidi paragraph shaping crash \(\#61651\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/c214057e086517920b214800725c5d16294ddf0d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: c214057e086517920b214800725c5d16294ddf0d

Requested commit: c214057e086517920b214800725c5d16294ddf0d

Commit: c214057e086517920b214800725c5d16294ddf0d

Tree: 2c46ae78a43144aab3e23df6f7c8ac3e4f133bc4

Author: Jakub Konka

Committer: GitHub

## Message

```
gpui_wgpu: Fix bidi paragraph shaping crash (#61651)

Closes FR-133

`cosmic-text`'s BiDi line shaping machinery (`ShapeLine::new`) asserts
that every BiDi paragraph is following the same direction. It turns out
that our `gpui_wgpu` line shaping adapter would not account for that
leading to panics if text contained multiple BiDi paragraphs with
multiple directions. Not super common but worth fixing as the fix is not
super complicated. At the same time, I'd like to point out that there is
a patch submitted to `cosmic-text` that redoes shaping logic so that
this is no longer illegal:
https://github.com/pop-os/cosmic-text/pull/508 If it gets accepted, we
can revert this fix.

Release Notes:
- Fixed panic in `gpui_wgpu` if text contained multiple BiDi paragraphs
with mismatched directions.
```

## Parents

- [1764c2fa6776c545ece60357e0e6dd9856a241bc](https://git.cafe/gitcafe/zed/commit/1764c2fa6776c545ece60357e0e6dd9856a241bc?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/c214057e086517920b214800725c5d16294ddf0d?format=markdown)
