mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
type chars rather than bytes
This commit is contained in:
parent
9ad45b6f2c
commit
afd1570bbc
2 changed files with 7 additions and 8 deletions
|
|
@ -278,20 +278,19 @@ impl Gam {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn type_keys(&self, s: &str) -> Result<bool, xous::Error> {
|
||||
pub fn type_chars(&self, s: &str) -> Result<bool, xous::Error> {
|
||||
let mut view = s.chars().peekable();
|
||||
|
||||
while view.peek().is_some() {
|
||||
let chunk: std::string::String = view.by_ref().take(4).collect();
|
||||
let bytes = chunk.as_bytes();
|
||||
send_message(self.conn,
|
||||
Message::new_scalar(Opcode::KeyboardEvent.to_usize().unwrap(),
|
||||
bytes[0] as usize,
|
||||
if bytes.len() > 1 {bytes[1]} else {0} as usize,
|
||||
if bytes.len() > 2 {bytes[2]} else {0} as usize,
|
||||
if bytes.len() > 3 {bytes[3]} else {0} as usize
|
||||
chunk.chars().nth(0).unwrap() as usize,
|
||||
if chunk.len() > 1 {chunk.chars().nth(1).unwrap()} else {'\u{0000}'} as usize,
|
||||
if chunk.len() > 2 {chunk.chars().nth(2).unwrap()} else {'\u{0000}'} as usize,
|
||||
if chunk.len() > 3 {chunk.chars().nth(3).unwrap()} else {'\u{0000}'} as usize
|
||||
)
|
||||
).expect("Couldn't type keys");
|
||||
).expect("Couldn't type chars");
|
||||
}
|
||||
|
||||
Ok(true)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
|
|||
editcmd.push_str(" ");
|
||||
editcmd.push_str(&s);
|
||||
|
||||
match _env.gam.type_keys(&editcmd) {
|
||||
match _env.gam.type_chars(&editcmd) {
|
||||
Ok(_) => {
|
||||
write!(ret, "Edit the value and press enter:").unwrap()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue