Commit b257a5d2 authored by Ticki's avatar Ticki

Forgot to add

parent 9abf4fd4
- [x] Make editor.pos method and use that instead of
- [ ] Add word navigation
- [ ] `.` command
- [ ] More partial redrawing (register "is_modified")
Known bugs:
......
use redox::*;
use super::*;
/// Key state
pub struct KeyState {
pub ctrl: bool,
pub alt: bool,
pub shift: bool,
}
impl KeyState {
pub fn new() -> KeyState {
KeyState {
ctrl: false,
alt: false,
shift: false,
}
}
/// Feed the keystate
pub fn feed(&mut self, k: orbital::event::KeyEvent) -> Option<Key> {
let c = k.character;
match c {
'\0' => {
// "I once lived here" - bug
match k.scancode {
K_ALT => self.alt = k.pressed,
K_CTRL => self.ctrl = k.pressed,
K_LEFT_SHIFT | K_RIGHT_SHIFT => self.shift = k.pressed,
_ if k.pressed => {
return Some(Key::from_event(k));
},
_ => {},
}
},
_ if k.pressed => {
return Some(Key::from_event(k));
},
_ => {},
}
None
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment