INNER CODE UNIT · Rust

editing_command

keon/browser-control · src/actions.rs:161

pub fn editing_command(modifiers: u64, key: &str) -> Option<&'static str> {
    if modifiers & (MOD_CTRL | MOD_META) == 0 {
        return None;
    }
    match (
        key.to_ascii_lowercase().as_str(),
        modifiers & MOD_SHIFT != 0,
    ) {
        ("a", false) => Some("selectAll"),
        ("c", false) => Some("copy"),
        ("x", false) => Some("cut"),
        ("v", false) => Some("paste"),
        ("z", false) => Some("undo"),
        ("z", true) | ("y", false) => Some("redo"),
        _ => None,
    }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…