wxStyledTextCtrl (STC) has problem when copy/pasting unicode characters out of the STC. I'm able to paste unicode strings into the STC but unable copy out of the STC. The problem exists under Linux but not under macOS.
The problem can be demonstrated by using the wxWidgets stctest sample app.
Experiment to replicate:
stctest and paste some unicode string (e.g. αβγδεζηθικλμ) into it. It will succeed.stctest. Under Linux it will fail. However, if you paste it somewhere else in the same STC, it will succeed.I have looked at the library file src/gtk/clipbrd.cpp but I’m not very familiar with the GTK API and it is not obvious to me what’s wrong.
I'm using Ubuntu 22.04.2 with Wayland and wxWidgets 3.2.2.1. I built the wxWidgets library using ../configure --disable-shared --enable-cxx11 --prefix="$(pwd)" --with-gtk=3 --with-libpng=builtin
Note: As suggested by Igor (https://stackoverflow.com/q/76494233/2002012) I rebuilt the wxWidgets library for debug (--enable-debug) and rebuilt stctest. When I run the experiment above and copy from one instance of stctest to a second instance of ststest, I get the message: An assertion failed!
../src/gtk/clipbrd.cpp(756): assert ""m_formatSupported"" failed in GetData(): error retrieving data from clipboard
Thank you in advance, any help will be appreciated.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for reporting this, I do see this problem with Wayland too.
The difference between X11 and Wayland is that while we advertise supporting both UTF8_STRING and STRING formats in both cases, under X11 we get asked to provide data in the former format, while under Wayland we're asked to provide it in the latter, i.e. our selection handler is called with GtkSelectionData using STRING. The current code doesn't support using this with non-ASCII data at all, but even if I fix this, the returned data doesn't get pasted correctly in the other applications, e.g. gedit shows α as literal \u03b1 (i.e. 6 characters) when it's pasted.
The only way I found to make this work is to not advertise STRING at all. If we only claim to provide UTF8_STRING, then we only get asked for it and everything works fine. But I'm not sure if we don't lose interoperability with some old applications if we do it. However old applications are unlikely to use Wayland natively. So maybe we should only return STRING when using X11?
@paulcor Please let me know if you know more about this by chance, TIA!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Closed #23650 as completed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
This has been fixed. See #24701
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()