Make ctrl+6 work as ctrl+^

This commit is contained in:
daa 2017-04-01 00:12:00 +03:00
parent 8bd254a864
commit 4b3d93e9a1

View File

@ -6,9 +6,20 @@ use phf;
include!(concat!(env!("OUT_DIR"), "/key_map_table.rs")); 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(); 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 state.contains(gdk::SHIFT_MASK) {
if val != "\"" { if val != "\"" {
input.push_str("S-"); input.push_str("S-");