Skip to content

do not truncate usernames by word boundaries, instead truncate by grapheme - #651

Open
kaizoplant wants to merge 1 commit into
ulyssa:mainfrom
kaizoplant:take_width_grapheme
Open

do not truncate usernames by word boundaries, instead truncate by grapheme#651
kaizoplant wants to merge 1 commit into
ulyssa:mainfrom
kaizoplant:take_width_grapheme

Conversation

@kaizoplant

Copy link
Copy Markdown
Contributor

Previously, usernames truncated by user_gutter_width with word boundaries, such as display names like [somelongtexthere] or more relevant, usernames like @username:some.domain would be completely cut off after the first character. This pr makes it so that these will always just use the grapheme calculation directly.

Maybe this should be a config option? Although I do think it is usually preferable to have the username as visible as possible, it might still be useful to not always have this behavior.

@VAWVAW

VAWVAW commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

I believe the UnicodeSegmentation functions were always relatively CPU intensive. Have you tested whether this may introduce lag on lower-end systems?

@kaizoplant

Copy link
Copy Markdown
Contributor Author

It doesn't seem to show up on the flamegraph for me so I imagine it shouldn't be too much of a problem. Also previously, it was still calling into split_word_bound_indices which I imagine was a bit worse for long usernames and display names (especially display names given it'd have to call split_word_bound_indices and then grapheme_indices after it failed), maybe it's better if it calls into something else entirely but it doesn't seem like too much of an issue rn?

@VAWVAW VAWVAW left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants