1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

egui-winit: if clipboard fails to start, fall back to local clipboard

This commit is contained in:
Emil Ernerfeldt
2022-04-12 11:39:35 +02:00
parent d364dfac66
commit 08b208586a
3 changed files with 17 additions and 22 deletions

View File

@@ -412,9 +412,10 @@ impl State {
self.egui_input.events.push(egui::Event::Copy);
} else if is_paste_command(self.egui_input.modifiers, keycode) {
if let Some(contents) = self.clipboard.get() {
self.egui_input
.events
.push(egui::Event::Paste(contents.replace("\r\n", "\n")));
let contents = contents.replace("\r\n", "\n");
if !contents.is_empty() {
self.egui_input.events.push(egui::Event::Paste(contents));
}
}
}
}