# editor: Fix bracket colorization with folds and large functions \(\#51108\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 4bd1a090d939534ceec725307d43e7b154832950

Requested commit: 4bd1a090d939534ceec725307d43e7b154832950

Commit: 4bd1a090d939534ceec725307d43e7b154832950

Tree: 706c67d1a2473ed18d680e3bf553953fe30f0c7e

Author: Lee ByeongJun

Committer: GitHub

## Message

````
editor: Fix bracket colorization with folds and large functions (#51108)

Closes #47846

`visible_excerpts` computed the visible buffer range by adding display
line count directly to the buffer start row:

```rust
// Before
multi_buffer_visible_start + Point::new(visible_line_count, 0)
```
This ignores folds entirely. When a 700-line function is folded into one
display line, content after the fold is visible on screen but falls
outside the computed buffer range, so its brackets are never colorized.

The fix converts through display coordinates so the fold/wrap layers are
respected:

```rust
// After
let display_end = DisplayPoint::new(display_start.row + visible_line_count, 0);
let multi_buffer_visible_end = display_end.to_point(&display_snapshot);
```

### Results

**Before Fix**
<img width="852" height="778" alt="스크린샷 2026-03-10 오후 8 29 10"
src="https://github.com/user-attachments/assets/a0d2d81f-a8b2-4cf4-b1f3-cf5f8288a696"
/>

**After Fix**
<img width="1031" height="794" alt="스크린샷 2026-03-10 오후 8 32 27"
src="https://github.com/user-attachments/assets/2b0496b1-8302-4248-b73a-c31f5d0b0c4b"
/>

Before you mark this PR as ready for review, make sure that you have:
- [X] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed bracket colorization not working for content after folded
regions and for functions with large bodies.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
````

## Parents

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

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