Repository navigation
Conversation
Ctrl+C or Copy on a selection in a message put plain text on the clipboard and nothing else, so a signature, a message or a document it was pasted into lost its bold, colours, sizes and links. The copy now writes HTML beside the text. It is made from the spans each text was laid out from (kept on TextItem::spans, as the message gave them, not as the pane draws them: a dark window's light text would not be read on a signature's white page): bold, italic, underline, strike-through, colour, highlight, size, font, and links a message may have (http, https, mailto, tel). Everything is escaped, and a system that cannot take HTML gets the text alone, as before. Pictures are not copied. Human-reviewed, AI-assisted, nobody's mailbox harmed.
…message A picture that is shown, whole in the copied selection, now goes in the HTML as an <img> that carries its own bytes (data:), at the width it is shown and with its description. edit.paste takes such pictures out of the pasted HTML, checks them to be pictures by their own bytes, and keeps them where they stood: in the open signature, within its caps (256 KB each, 512 KB in all, ten at most; the note says when one was left out), or in the message being written, within its own. Nothing is fetched. A plain-text message keeps none. Human-reviewed, AI-assisted, nobody's mailbox harmed.
…abs#2275) Human-reviewed, AI-assisted, nobody's mailbox harmed.
Human-reviewed, AI-assisted, nobody's mailbox harmed.
A selection of a message that was one picture and no words had no text, so a copy said "Select some text first" and put nothing on the clipboard; and even a picture inside a text only went as HTML, never as a picture a drawing program, a folder or a document pastes. A copy of a lone picture now puts the picture on the clipboard as a picture (`RichClipboard::put_image`; the system's own clipboard takes its pixels), and where the system cannot, it goes as HTML like any other. A selection with words keeps the copy with its look. Human-reviewed, AI-assisted, nobody's mailbox harmed.
copy_html.rs is a new file of the reading pane that the test of what the pane names (nothing that could fetch) counts: 31 files, not 30. Human-reviewed, AI-assisted, nobody's mailbox harmed.
…annot be copied leaves the clipboard as it is Fragments named for UCSLabs#2282. Human-reviewed, AI-assisted, nobody's mailbox harmed.
Human-reviewed, AI-assisted, nobody's mailbox harmed.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Human-reviewed, AI-assisted, nobody's mailbox harmed.
…t/copy-picture-as-image
Human-reviewed, AI-assisted, nobody's mailbox harmed.
Human-reviewed, AI-assisted, nobody's mailbox harmed.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #2282
Builds on #2237 (a draft until that is merged): the commits of that pull request are in this one too.
What changes for the person using MailCraft
A picture in a message can be copied as a picture, and pasted into a drawing program, a folder or a document:
The picture is read in the sizes a picture from the clipboard is taken in (4096 pixels a side), and a moving GIF goes as its first frame.
How it was checked
New tests in
reading/tests/copy_html.rs(a selection that is one picture is that picture, with no text; words or a second picture are not a lone picture).cargo test -p mailcraft-ui-egui --lib reading: 350 passed, 0 failed.cargo fmt --check,cargo clippy -p mailcraft-ui-egui --all-targets -- -D warnings,cargo xtask release-notesanddocs-logare clean;cargo check -p mailcraftbuilds.In a clean Windows sandbox, with a message that is one picture and another with words around it: Ctrl+A and Ctrl+C on the picture alone gives a 240 by 140 picture on the clipboard (the build without this change gives nothing); on the message with words, the clipboard has the text, the HTML with its picture and the bold; a right click on the picture, then Copy, gives the picture and no text.
It also fixes a count of the reading pane's source files in
reading/tests.rsthat Reading pane: Copy keeps the look and the pictures of the text, for a signature or a message it is pasted into #2237 left at 30 (copy_html.rsis the 31st), which fails without it.Not run: the full
cargo xtask ci; macOS, Linux and Wayland (the clipboard writes a picture througharboard); selecting the picture with a drag of the mouse (Select All and the right click were).cargo xtask cipassesA crash or data-loss fix has its regression test
"Allow edits by maintainers" is ticked (the box beside Create pull request)
I have signed the CLA, or will by commenting on this pull request
Human-reviewed, AI-assisted, nobody's mailbox harmed.