Fix handling of unicode characters > 255 (#411)

This commit is contained in:
Jan Hlavatý 2020-04-04 09:19:20 +02:00 committed by GitHub
parent 095731a174
commit 428519994c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -108,7 +108,10 @@ fn parse_key_event_record(key_event: &KeyEventRecord) -> Option<KeyEvent> {
Some(KeyCode::Char(character))
}
} else {
None
match std::char::from_u32(character_raw as u32) {
Some(ch) => Some(KeyCode::Char(ch)),
None => None,
}
}
}
};

View File

@ -133,7 +133,7 @@ impl From<Colored> for u16 {
const REMOVE_BG_MASK: u16 = BG_INTENSITY | BG_RED | BG_GREEN | BG_BLUE;
// remove all background values from the original color, we don't want to reset those.
(original_color & !(REMOVE_BG_MASK))
original_color & !REMOVE_BG_MASK
}
/* WinApi will be used for systems that do not support ANSI, those are windows version less then 10. RGB and 255 (AnsiBValue) colors are not supported in that case.*/
@ -165,7 +165,7 @@ impl From<Colored> for u16 {
const REMOVE_FG_MASK: u16 = FG_INTENSITY | FG_RED | FG_GREEN | FG_BLUE;
// remove all foreground values from the original color, we don't want to reset those.
(original_color & !(REMOVE_FG_MASK))
original_color & !REMOVE_FG_MASK
}
/* WinApi will be used for systems that do not support ANSI, those are windows version less then 10. RGB and 255 (AnsiBValue) colors are not supported in that case.*/
Color::Rgb { .. } => 0,