# gpui: Don't start a wrapped line with closing punctuation or a slash \(\#62743\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 4278ff36ef76916c719dfdd1557efd4401206985

Requested commit: 4278ff36ef76916c719dfdd1557efd4401206985

Commit: 4278ff36ef76916c719dfdd1557efd4401206985

Tree: d105ae397adf2fbe8e36a4acf493cd1ff199f717

Author: Alistair Smith

Committer: GitHub

## Message

```
gpui: Don't start a wrapped line with closing punctuation or a slash (#62743)

# Objective

`LineWrapper` treats every punctuation character as a break opportunity,
so a wrap can land right before `!`, `?`, `/`, `)`, `]`, `}`, a closing
quote or an ellipsis. Text such as `please fix this plz!`, `8.0/8.0`,
`cli/install`, `(see)` or `“quoted”` then wraps with the closing mark
orphaned at the start of the next line.

## Solution

Add the "UAX 14 LB13 rule" to `LineWrapper::is_word_char`, which is to
not break before `! ? / ) ] } " ” » …`

## Testing

Added unit tests and manually tested myself with a long paragraph in a
gpui app.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable (one
extra `matches!` per character in the wrap loop)

---

Release Notes:

- Fixed text wrapping so closing punctuation and slashes never begin a
wrapped line.

Co-authored-by: Lukas Wirth <lukas@zed.dev>
```

## Parents

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

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