BillyDM / egui-baseview

A baseview backend for the egui Rust GUI library
MIT License
22 stars 17 forks source link

Add clipboard support #1

Closed DGriffin91 closed 2 years ago

DGriffin91 commented 2 years ago

Add clipboard support (copy/cut/paste) using copypasta. Many other egui backends are also using copypasta for the clipboard support.

DGriffin91 commented 2 years ago

The latest update to this pull request adds additional key codes to translate_virtual_key_code(), matching egui's winit backend, and only does the egui::Event::Text() event if ctrl/cmd aren't pressed (also matching winit backend). With this setup the event for key presses is still available to users in ui.input().keys_down and ui.input().modifiers if ctrl/cmd is pressed, but it doesn't get registered as text input. This allows the ctrl/cmd-Z feature for undo to work as expected in egui text boxes.