From 4b3d93e9a1af751214760b1220527d27becb8393 Mon Sep 17 00:00:00 2001 From: daa Date: Sat, 1 Apr 2017 00:12:00 +0300 Subject: [PATCH] Make ctrl+6 work as ctrl+^ --- src/input.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/input.rs b/src/input.rs index 0e3a6a8..1e4fcba 100644 --- a/src/input.rs +++ b/src/input.rs @@ -6,9 +6,20 @@ use phf; include!(concat!(env!("OUT_DIR"), "/key_map_table.rs")); -pub fn keyval_to_input_string(val: &str, state: gdk::ModifierType) -> String { +pub fn keyval_to_input_string(in_str: &str, state: gdk::ModifierType) -> String { + let mut val = in_str; let mut input = String::new(); + // CTRL-^ and CTRL-@ don't work in the normal way. + if state.contains(gdk::CONTROL_MASK) && !state.contains(gdk::SHIFT_MASK) && + !state.contains(gdk::MOD1_MASK) { + if val == "6" { + val = "^"; + } else if val == "2" { + val = "@"; + } + } + if state.contains(gdk::SHIFT_MASK) { if val != "\"" { input.push_str("S-");