Fix wayland image paste error (#4824)

## Summary
- log and surface clipboard failures instead of silently ignoring them
when `Ctrl+V` pastes an image (`paste_image_to_temp_png()` now feeds an
error history cell)
- enable `arboard`’s `wayland-data-control` feature so native Wayland
sessions can deliver image data without XWayland
- keep the success path unchanged: valid images still attach and show
the `[image …]` placeholder as before

Fixes #4818

---------

Co-authored-by: Eric Traut <etraut@openai.com>
Co-authored-by: Jeremy Rose <172423086+nornagon-openai@users.noreply.github.com>
This commit is contained in:
George Nesterenok
2025-11-10 19:35:30 -03:00
committed by GitHub
parent 2ac49fea58
commit 52e97b9b6b
3 changed files with 137 additions and 3 deletions

View File

@@ -1143,8 +1143,21 @@ impl ChatWidget {
kind: KeyEventKind::Press,
..
} if modifiers.contains(KeyModifiers::CONTROL) && c.eq_ignore_ascii_case(&'v') => {
if let Ok((path, info)) = paste_image_to_temp_png() {
self.attach_image(path, info.width, info.height, info.encoded_format.label());
match paste_image_to_temp_png() {
Ok((path, info)) => {
self.attach_image(
path,
info.width,
info.height,
info.encoded_format.label(),
);
}
Err(err) => {
tracing::warn!("failed to paste image: {err}");
self.add_to_history(history_cell::new_error_event(format!(
"Failed to paste image: {err}",
)));
}
}
return;
}