mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-24 01:46:31 +00:00
BLT: Use bearlibterminal char function (#496)
It already handles shift, capslock and user keymap Leave fallback for when it doesnt work (CTRL pressed?)
This commit is contained in:
parent
792c4f1638
commit
049919b609
@ -369,8 +369,17 @@ fn colour_to_blt_colour(clr: Color, role: ColorRole) -> BltColor {
|
|||||||
BltColor::from_rgb(r, g, b)
|
BltColor::from_rgb(r, g, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::cognitive_complexity)]
|
|
||||||
fn blt_keycode_to_char(kc: KeyCode, shift: bool) -> char {
|
fn blt_keycode_to_char(kc: KeyCode, shift: bool) -> char {
|
||||||
|
let bltchar = bear_lib_terminal::terminal::state::char();
|
||||||
|
if bltchar == '\u{0}' {
|
||||||
|
return blt_keycode_to_char_impl(kc, shift);
|
||||||
|
} else {
|
||||||
|
return bltchar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::cognitive_complexity)]
|
||||||
|
fn blt_keycode_to_char_impl(kc: KeyCode, shift: bool) -> char {
|
||||||
match kc {
|
match kc {
|
||||||
KeyCode::A if shift => 'A',
|
KeyCode::A if shift => 'A',
|
||||||
KeyCode::A => 'a',
|
KeyCode::A => 'a',
|
||||||
|
Loading…
Reference in New Issue
Block a user