mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-29 01:34:37 +01:00
Text copied or cut while editing reached the clipboard as plain characters, and a paste inserted them in the style at the caret, so the copied font, size, colour and text style were lost. A whole text layer copied with Cmd/Ctrl+C and pasted into another text's edit lost them the same way. Shift+Cmd/Ctrl+V and Alt+Cmd/Ctrl+V while editing did nothing useful: on the desktop egui-winit sends those chords as keys, and no text binding took them. A copy or cut while editing now also keeps the selection's style runs (textedit::selected_rich_text), and a copy of text layers keeps theirs (textedit::layers_rich_text, joined with line breaks as the clipboard's text is). A run coloured by its layer's fill carries that fill, since a run without fills of its own takes the fill of whatever layer it lands in. A paste whose text is still that copied text inserts it with those runs (textedit::insert_rich); a run linked to a text style the file doesn't have keeps its look and drops the link, and fills equal to the destination layer's are left to the layer. The copy also carries the data of the images the runs' fills use, and the paste adds it where the file lacks that key, as a layer paste does, so an image fill resolves in another file. Text from another app pastes as before. Shift+Cmd/Ctrl+V while editing, and Alt+Cmd/Ctrl+V, read the clipboard's text and insert it plain, in the style at the caret; in the browser, where the chord also brings a paste event, the event is used and the key only marks the chord as handled, and the chord on that key, not the modifiers held when the event is read, picks the plain paste. Shift alone is another paste key (Shift+Insert) and keeps the formatting. Outside text editing Shift+Cmd/Ctrl+V is still Paste over selection and Alt+Cmd/Ctrl+V Paste properties.