click test, osk test
This commit is contained in:
21
src/utils.rs
21
src/utils.rs
@@ -1,5 +1,26 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use termion::event::Key;
|
||||
|
||||
use crate::window_manager::KeyChar;
|
||||
|
||||
//use Linear A for escape, backspace, enter
|
||||
pub fn key_to_char(key: Key) -> Option<KeyChar> {
|
||||
match key {
|
||||
Key::Char('\n') => Some(KeyChar::Press('𐘂')),
|
||||
Key::Char(c) => Some(KeyChar::Press(c)),
|
||||
Key::Alt(c) => Some(KeyChar::Alt(c)),
|
||||
Key::Ctrl(c) => Some(KeyChar::Ctrl(c)),
|
||||
Key::Backspace => Some(KeyChar::Press('𐘁')),
|
||||
Key::Esc => Some(KeyChar::Press('𐘃')),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn min(one: usize, two: usize) -> usize {
|
||||
if one > two { two } else { one }
|
||||
}
|
||||
|
||||
pub trait Substring {
|
||||
fn substring(&self, start: usize, end: usize) -> &str;
|
||||
fn remove(&self, index: usize, len: usize) -> String;
|
||||
|
||||
Reference in New Issue
Block a user