Support more string encodings and allow copying unescaped strings (#288)

* Copy strings without escape sequences in them

* Add support for more encodings from encoding_rs

Also use encoding_rs instead of CStr for UTF-8.
This commit is contained in:
LagoLunatic
2025-11-22 21:36:41 -05:00
committed by GitHub
parent 26a4cc79cf
commit 481dbc185a
3 changed files with 25 additions and 21 deletions

View File

@@ -871,19 +871,13 @@ pub fn context_menu_items_ui(
match item {
ContextItem::Copy { value, label } => {
let mut job = LayoutJob::default();
write_text("Copy ", appearance.text_color, &mut job, appearance.code_font.clone());
write_text(
"Copy \"",
appearance.text_color,
&mut job,
appearance.code_font.clone(),
);
write_text(
&value,
&format!("{value:?}"),
appearance.highlight_color,
&mut job,
appearance.code_font.clone(),
);
write_text("\"", appearance.text_color, &mut job, appearance.code_font.clone());
if let Some(label) = label {
write_text(" (", appearance.text_color, &mut job, appearance.code_font.clone());
write_text(