# Respect max line limit for invisible character replacements \(\#57137\) · gitcafe/zed

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

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

Visibility: public

Requested revision: d33a3186aab63ac3b57c9cbe1da7b482d42c2fc5

Requested commit: d33a3186aab63ac3b57c9cbe1da7b482d42c2fc5

Commit: d33a3186aab63ac3b57c9cbe1da7b482d42c2fc5

Tree: 1110b2a2fe0889c161280f6d61b7da2ef75a55b1

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
Respect max line limit for invisible character replacements (#57137)

This change makes sure that `LineWithInvisibles::from_chunks` applies
the max line length limit to invisible character replacements as it does
to normal text chunks.

Without this change, pathological lines containing many invisible
characters could produce unbounded number of line fragments.

Closes FR-6.

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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

- Fixed a rare panic that could occur when lines in the editor contained
many invisible characters.
```

## Parents

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

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