Commit 86fc7661 authored by Jeremy Soller's avatar Jeremy Soller

Update orbclient

Add exit key
parent e160513d
......@@ -7,8 +7,9 @@ Sodium: A modern vi-like editor
"""
[dependencies]
orbclient = "0.1.12"
orbclient = "0.3"
[features]
default = ["orbital"]
orbital = []
ansi = []
......@@ -24,6 +24,11 @@ impl Editor {
self.prompt = String::new();
self.cursor_mut().mode = Mode::Command(CommandMode::Normal);
}
(Primitive(Insert(_)), Escape) => {
let left = self.left(1);
self.goto(left);
self.cursor_mut().mode = Mode::Command(CommandMode::Normal);
},
(Primitive(Insert(_)), Char(' ')) if self.key_state.shift => {
let left = self.left(1);
self.goto(left);
......
......@@ -7,7 +7,7 @@ use state::editor::Editor;
use state::mode::{Mode, PrimitiveMode};
#[cfg(feature = "orbital")]
use orbclient::Color;
use orbclient::{Color, Renderer};
#[cfg(feature = "orbital")]
impl Editor {
......
......@@ -42,22 +42,22 @@ impl Key {
/// Convern an Orbital key event to a `Key`.
#[cfg(feature = "orbital")]
pub fn from_event(k: KeyEvent) -> Key {
match k.character {
'\0' => match k.scancode {
s if k.pressed => match s {
K_BKSP => Key::Backspace,
K_LEFT => Key::Left,
K_RIGHT => Key::Right,
K_UP => Key::Up,
K_DOWN => Key::Down,
K_TAB => Key::Tab,
K_ESC => Key::Escape,
_ => Key::Unknown(s),
},
_ => Key::Null,
},
c => Key::Char(c),
if k.pressed {
match k.scancode {
K_BKSP => Key::Backspace,
K_LEFT => Key::Left,
K_RIGHT => Key::Right,
K_UP => Key::Up,
K_DOWN => Key::Down,
K_TAB => Key::Tab,
K_ESC => Key::Escape,
s => match k.character {
'\0' => Key::Unknown(s),
c => Key::Char(c),
}
}
} else {
Key::Null
}
}
......
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