MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / handle_printable

Method handle_printable

src/sys/prompt.rs:356–374  ·  view source on GitHub ↗

Handle printable keys

(&mut self, c: char)

Source from the content-addressed store, hash-verified

354
355 // Handle printable keys
356 fn handle_printable(&mut self, c: char)
357 {
358 self.compupdate();
359 self.histupdate();
360 if crate::sys::console::canprint(c)
361 {
362 let i = self.cur - self.offset;
363 self.ln.insert(i, c);
364
365 // Use UTF-32
366 let s = &self.ln[i..];
367 let n = s.len();
368
369 // Use UTF-8
370 let s: String = s.iter().collect();
371 print!("{} \x1b[{}D", s, n);
372 self.cur += 1;
373 }
374 }
375
376
377 // Handle tab key

Callers 1

printMethod · 0.80

Calls 4

compupdateMethod · 0.80
histupdateMethod · 0.80
canprintFunction · 0.70
lenMethod · 0.45

Tested by

no test coverage detected