Skip to content

Conversation

ctchen222
Copy link
Contributor

@ctchen222 ctchen222 commented Aug 29, 2025

The previous implementation used vim.fn.strwidth() to calculate the end column for header highlighting. This function returns the display width, which can differ from the byte length when multi-byte characters like emojis are present.

Since the end_col for extmarks expects a byte-based index, this caused the highlighting to be applied incorrectly.

This patch corrects the issue by using the byte length (#header_value) for the end_col of the highlight extmark, while still using vim.fn.strwidth() for virt_text_win_col to ensure correct visual alignment of UI elements.

Fixes #1384

@ctchen222
Copy link
Contributor Author

Fix #1384

@deathbeam deathbeam added the bug Something isn't working label Aug 29, 2025
@deathbeam deathbeam merged commit f844a68 into CopilotC-Nvim:main Aug 29, 2025
1 check passed
@deathbeam
Copy link
Collaborator

thanks!

@all-contributors add @ctchen222 for code

Copy link
Contributor

@deathbeam

I've put up a pull request to add @ctchen222! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Header text partially highlighted
2 participants