Preserve Markdown formatting when copying TUI responses (#42847)

## What changed

- Add rendered HTML alongside the original Markdown when copying a whole response through the native clipboard, so rich-text destinations preserve headings, lists, tables, code, and other formatting.
- Keep code-block, blockquote, transcript, terminal, and WSL clipboard copies as plain text.
- Escape raw HTML, omit remote image sources, and render unsupported link destinations as visible text when producing clipboard HTML.

## Testing

- Add coverage for rich formatting, local and unsafe links, inert images, fenced tables, copy selection formats, and clipboard fallbacks.

GitOrigin-RevId: c6f5edd88b65f9e9b1ddc5618442868cf47ee560
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-09-04 20:38:08 +00:00
1 parent 9c4253ffc1
commit 7a8092a447
17 files changed
+329 -57

No files matched your search

+2 -2
View File
@@ -205,8 +205,8 @@ impl App {
self.chat_widget.maybe_send_next_queued_input();
}
}
AppEvent::CopySelection { text, label } => {
self.chat_widget.copy_selection(text, label);
AppEvent::CopySelection { text, label, format } => {
self.chat_widget.copy_selection(text, label, format);
}
AppEvent::ClearUi { name } => {
self.clear_terminal_ui(tui, /*redraw_header*/ false)?;