diff --git a/src/event/sys/windows/parse.rs b/src/event/sys/windows/parse.rs index f4b6887ac..93000b86d 100644 --- a/src/event/sys/windows/parse.rs +++ b/src/event/sys/windows/parse.rs @@ -97,6 +97,13 @@ fn parse_key_event_record(key_event: &KeyEventRecord) -> Option { let c = character_raw as u8; if c <= b'\x1F' { character = (c | b'\x40') as char; + // if we press something like ctrl-g, we will get `character` with value `G`. + // in this case, convert the `character` to lowercase `g`. + if character.is_ascii_uppercase() + && !modifiers.contains(KeyModifiers::SHIFT) + { + character.make_ascii_lowercase(); + } } else { return None; } diff --git a/src/style/sys/windows.rs b/src/style/sys/windows.rs index b2bb7f687..91cc2df07 100644 --- a/src/style/sys/windows.rs +++ b/src/style/sys/windows.rs @@ -28,10 +28,9 @@ pub(crate) fn set_foreground_color(fg_color: Color) -> Result<()> { // Notice that the color values are stored in wAttribute. // So we need to use bitwise operators to check if the values exists or to get current console colors. - let mut color: u16; let attrs = csbi.attributes(); let bg_color = attrs & 0x0070; - color = color_value | bg_color; + let mut color = color_value | bg_color; // background intensity is a separate value in attrs, // wee need to check if this was applied to the current bg color. @@ -53,10 +52,9 @@ pub(crate) fn set_background_color(bg_color: Color) -> Result<()> { // Notice that the color values are stored in wAttribute. // So wee need to use bitwise operators to check if the values exists or to get current console colors. - let mut color: u16; let attrs = csbi.attributes(); let fg_color = attrs & 0x0007; - color = fg_color | color_value; + let mut color = fg_color | color_value; // Foreground intensity is a separate value in attrs, // So we need to check if this was applied to the current fg color.