mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-12 20:23:35 +00:00
parent
5e58726ffd
commit
1ae3bbff89
@ -48,7 +48,7 @@ version = "5.91.0"
|
|||||||
[dependencies.pancurses]
|
[dependencies.pancurses]
|
||||||
features = ["wide"]
|
features = ["wide"]
|
||||||
optional = true
|
optional = true
|
||||||
version = "0.14"
|
version = "0.15"
|
||||||
|
|
||||||
[dependencies.pulldown-cmark]
|
[dependencies.pulldown-cmark]
|
||||||
default-features = false
|
default-features = false
|
||||||
|
@ -8,7 +8,6 @@ use std::cell::{Cell, RefCell};
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::{stdout, Write};
|
use std::io::{stdout, Write};
|
||||||
use theme::{Color, ColorPair, Effect};
|
use theme::{Color, ColorPair, Effect};
|
||||||
use utf8;
|
|
||||||
use vec::Vec2;
|
use vec::Vec2;
|
||||||
|
|
||||||
pub struct Concrete {
|
pub struct Concrete {
|
||||||
@ -244,33 +243,10 @@ impl backend::Backend for Concrete {
|
|||||||
pancurses::Input::Character('\u{1b}') => {
|
pancurses::Input::Character('\u{1b}') => {
|
||||||
Event::Key(Key::Esc)
|
Event::Key(Key::Esc)
|
||||||
}
|
}
|
||||||
pancurses::Input::Character(c)
|
|
||||||
if 32 <= (c as u32) && (c as u32) <= 255 =>
|
|
||||||
{
|
|
||||||
// TODO: pancurses may start parsing the input.
|
|
||||||
// In this case, return as-is.
|
|
||||||
utf8::read_char(c as u8, || {
|
|
||||||
self.window.getch().and_then(|i| match i {
|
|
||||||
pancurses::Input::Character(c) => {
|
|
||||||
Some(c as u8)
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
}).map(Event::Char)
|
|
||||||
.unwrap_or_else(|e| {
|
|
||||||
warn!("Error reading input: {}", e);
|
|
||||||
Event::Unknown(vec![c as u8])
|
|
||||||
})
|
|
||||||
}
|
|
||||||
pancurses::Input::Character(c) if (c as u32) <= 26 => {
|
pancurses::Input::Character(c) if (c as u32) <= 26 => {
|
||||||
Event::CtrlChar((b'a' - 1 + c as u8) as char)
|
Event::CtrlChar((b'a' - 1 + c as u8) as char)
|
||||||
}
|
}
|
||||||
pancurses::Input::Character(c) => {
|
pancurses::Input::Character(c) => Event::Char(c),
|
||||||
let mut bytes = [0u8; 4];
|
|
||||||
Event::Unknown(
|
|
||||||
c.encode_utf8(&mut bytes).as_bytes().to_vec(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// TODO: Some key combos are not recognized by pancurses,
|
// TODO: Some key combos are not recognized by pancurses,
|
||||||
// but are sent as Unknown. We could still parse them here.
|
// but are sent as Unknown. We could still parse them here.
|
||||||
pancurses::Input::Unknown(code) => self.key_codes
|
pancurses::Input::Unknown(code) => self.key_codes
|
||||||
@ -507,7 +483,6 @@ fn get_mouse_button(bare_event: mmask_t) -> MouseButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn initialize_keymap() -> HashMap<i32, Event> {
|
fn initialize_keymap() -> HashMap<i32, Event> {
|
||||||
|
|
||||||
let mut map = HashMap::new();
|
let mut map = HashMap::new();
|
||||||
|
|
||||||
super::fill_key_codes(&mut map, pancurses::keyname);
|
super::fill_key_codes(&mut map, pancurses::keyname);
|
||||||
|
Loading…
Reference in New Issue
Block a user