diff options
author | Christian Persch <chpe@src.gnome.org> | 2023-04-11 20:54:44 +0200 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2023-04-11 20:54:44 +0200 |
commit | 587873b5cd4cedff259d32e37a37f11562f6dc11 (patch) | |
tree | 501ac7e23e04b363a9ce8deb8b3be1642f1a2847 | |
parent | 19acc51708d9e75ef2b314aa026467570e0bd8ee (diff) | |
download | vte-587873b5cd4cedff259d32e37a37f11562f6dc11.tar.gz |
widget: Fix setting clipboard with html data
Fixes: https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/7975
-rw-r--r-- | src/clipboard-gtk.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/clipboard-gtk.cc b/src/clipboard-gtk.cc index b7fc6246..17cec015 100644 --- a/src/clipboard-gtk.cc +++ b/src/clipboard-gtk.cc @@ -113,19 +113,22 @@ private: break; case ClipboardFormat::HTML: { - auto const type = gtk_selection_data_get_data_type(data); + auto const target = gtk_selection_data_get_target(data); - if (type == gdk_atom_intern_static_string(MIME_TYPE_TEXT_HTML_UTF8)) { + if (target == gdk_atom_intern_static_string(MIME_TYPE_TEXT_HTML_UTF8)) { // This makes yet another copy of the data... :( - gtk_selection_data_set_text(data, str->data(), str->size()); + gtk_selection_data_set(data, + target, + 8, + reinterpret_cast<guchar const*>(str->data()), + str->size()); } else if (type == gdk_atom_intern_static_string(MIME_TYPE_TEXT_HTML_UTF16)) { auto [html, len] = text_to_utf16_mozilla(*str); // This makes yet another copy of the data... :( if (html) { gtk_selection_data_set(data, - gtk_selection_data_get_target(data), - // or gdk_atom_intern_static_string("text/html"), + target, 16, reinterpret_cast<guchar const*>(html.get()), len); |