# agent: Truncate display name using grapheme clusters in config option selector \(\#59898\) · gitcafe/zed

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

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

Visibility: public

Requested revision: b6e1e2788771fec810b5573ca900cb76250014e8

Requested commit: b6e1e2788771fec810b5573ca900cb76250014e8

Commit: b6e1e2788771fec810b5573ca900cb76250014e8

Tree: 18dc9df5fbea936352c2087de97ef5de81963905

Author: DamonXue

Committer: GitHub

## Message

```
agent: Truncate display name using grapheme clusters in config option selector (#59898)

This pull request updates how long configuration option names are
displayed in the UI to better handle Unicode characters, ensuring that
names are truncated by grapheme clusters (user-perceived characters)
rather than bytes or code points. This prevents visual glitches with
multi-codepoint characters like emojis or accented letters. The main
changes are:

**Unicode handling improvements:**

* Added the `unicode-segmentation` crate as a workspace dependency in
`Cargo.toml` to support grapheme-aware string operations.
* Updated import statements in `config_options.rs` to include
`unicode_segmentation::UnicodeSegmentation`.

**UI display logic:**

* Changed the truncation logic for configuration option display names in
`ConfigOptionSelector` to use `.graphemes(true).take(32)` instead of
slicing bytes, ensuring proper handling of Unicode graphemes.

--- 

Release Notes:

- Agent: Made label truncation of configuration options in the agent
panel more robust against non-single-byte characters like emojis and
others.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
```

## Parents

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

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