Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipboard: Pasting UTF-8 multibyte sequences broken #410

Open
vain opened this issue Jun 27, 2024 · 0 comments
Open

Clipboard: Pasting UTF-8 multibyte sequences broken #410

vain opened this issue Jun 27, 2024 · 0 comments

Comments

@vain
Copy link
Contributor

vain commented Jun 27, 2024

The pasting code iterates over the bytes we read from wl-paste/xclip and that breaks when you try to paste multibyte sequences:

bemenu/lib/menu.c

Lines 1199 to 1203 in 5bc8a6c

for (size_t i = 0; i < pasted_len; i++) {
size_t width;
menu->cursor += bm_unicode_insert(&menu->filter, &menu->filter_size, menu->cursor, pasted_buf[i], &width);
menu->curses_cursor += width;
}

As an example, select this character: ö and try to paste it.

The code calls bm_unicode_insert(), which expects unicode codepoints, not raw bytes. We have to UTF-8-decode the whole string first.

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

No branches or pull requests

1 participant