# Add file icons to multibuffer view \(\#36836\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 11545c669e100392a8ca60063476037ab52c7cb5

Requested commit: 11545c669e100392a8ca60063476037ab52c7cb5

Commit: 11545c669e100392a8ca60063476037ab52c7cb5

Tree: 5baf840f9378191a5deea03aeba517a747d560d2

Author: Aleksei Gusev

Committer: GitHub

## Message

````
Add file icons to multibuffer view (#36836)

<img width="1988" height="1420" alt="multi-buffer-icons-git-diff"
src="https://github.com/user-attachments/assets/48f9722f-ca09-4aa7-ad7a-0b7e85f440d9"
/>

Unfortunately, `cargo format` decided to reformat everything. Probably,
because of hitting the right margin, no idea. The essence of this change
is the following:

```rust
.map(|path_header| {
    let filename = filename
        .map(SharedString::from)
        .unwrap_or_else(|| "untitled".into());
    let path = path::Path::new(filename.as_str());
    let icon =
        FileIcons::get_icon(path, cx).unwrap_or_default();
    let icon = Icon::from_path(icon).color(Color::Muted);

    let label = Label::new(filename).single_line().when_some(
        file_status,
        |el, status| {
            el.color(if status.is_conflicted() {
                Color::Conflict
            } else if status.is_modified() {
                Color::Modified
            } else if status.is_deleted() {
                Color::Disabled
            } else {
                Color::Created
            })
            .when(status.is_deleted(), |el| el.strikethrough())
        },
    );

    path_header.child(icon).child(label)
})
``` 

Release Notes:

- Added file icons to multi buffer view
````

## Parents

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

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