feat(display): windows: full-screen, F1 cycles, OS bar (names, front, user); canvas-only (display-owned buffers, 4 max, reused); launchers OPEN (pm per app, terminal own), window caps minted by display; FORGET on launcher death via init courier; raster crate (font, chunked text); F-keys in input; terminal+snake on canvas; REDRAW gone
This commit is contained in:
@@ -37,6 +37,8 @@ pub fn key(code: u16, shift: bool) -> Option<Key> {
|
||||
105 => Some(Key::Left),
|
||||
106 => Some(Key::Right),
|
||||
43 => Some(Key::Char(if shift { b'|' } else { b'\\' })),
|
||||
59..=68 => Some(Key::Function((code - 58) as u8)),
|
||||
87 | 88 => Some(Key::Function((code - 76) as u8)),
|
||||
_ => None,
|
||||
};
|
||||
named.or_else(|| {
|
||||
@@ -52,6 +54,13 @@ pub fn key(code: u16, shift: bool) -> Option<Key> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn function_keys_are_numbered() {
|
||||
assert_eq!(key(59, false), Some(Key::Function(1)));
|
||||
assert_eq!(key(68, false), Some(Key::Function(10)));
|
||||
assert_eq!(key(88, true), Some(Key::Function(12)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ctrl_letters_are_control_characters() {
|
||||
assert_eq!(with_ctrl(Key::Char(b'c')), Key::Char(3));
|
||||
|
||||
Reference in New Issue
Block a user