click test, osk test

This commit is contained in:
stjet
2025-02-05 08:18:44 +00:00
parent 8d0a317819
commit a2c53aba27
9 changed files with 126 additions and 47 deletions

View File

@@ -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;