Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ impl State {
// are mapped to the physical keys that normally contain C, X, V, etc.
// See also: https://github.com/emilk/egui/issues/3653
if let Some(active_key) = logical_key.or(physical_key) {
if pressed {
if pressed && self.egui_ctx.options(|o| o.default_shortcuts) {
if is_cut_command(self.egui_input.modifiers, active_key) {
self.egui_input.events.push(egui::Event::Cut);
return;
Expand Down
13 changes: 13 additions & 0 deletions crates/egui/src/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ pub struct Options {
#[cfg_attr(feature = "serde", serde(skip))]
pub zoom_with_keyboard: bool,

/// If `true`, common keyboard shortcuts will be converted into events such as `Copy` and
/// `Paste`.
///
/// This is `true` by default.
pub default_shortcuts: bool,

/// Controls the tessellator.
pub tessellation_options: epaint::TessellationOptions,

Expand Down Expand Up @@ -323,6 +329,7 @@ impl Default for Options {
system_theme: None,
zoom_factor: 1.0,
zoom_with_keyboard: true,
default_shortcuts: true,
tessellation_options: Default::default(),
repaint_on_widget_change: false,
max_passes: NonZeroUsize::new(2).unwrap(),
Expand Down Expand Up @@ -381,6 +388,7 @@ impl Options {
system_theme: _,
zoom_factor: _, // TODO(emilk)
zoom_with_keyboard,
default_shortcuts,
tessellation_options,
repaint_on_widget_change,
max_passes,
Expand Down Expand Up @@ -415,6 +423,11 @@ impl Options {
"Zoom with keyboard (Cmd +, Cmd -, Cmd 0)",
);

ui.checkbox(
default_shortcuts,
"Default keyboard shortcuts (Cut, Copy, Paste)",
);

ui.checkbox(warn_on_id_clash, "Warn if two widgets have the same Id");

ui.checkbox(reduce_texture_memory, "Reduce texture memory");
Expand Down
Loading