feat(userspace): terminal server + shell desktop; US keymap w/ shift; libkos allocator multi-page fix; panics print
This commit is contained in:
@@ -74,7 +74,14 @@ pub mod text {
|
||||
let len = s.len().min(TEXT_BYTES);
|
||||
let mut bytes = [0u8; TEXT_BYTES];
|
||||
bytes[..len].copy_from_slice(&s[..len]);
|
||||
Self { x, y, fg, bg, bytes, len }
|
||||
Self {
|
||||
x,
|
||||
y,
|
||||
fg,
|
||||
bg,
|
||||
bytes,
|
||||
len,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn chars(&self) -> &[u8] {
|
||||
@@ -85,7 +92,9 @@ pub mod text {
|
||||
let (lo, hi) = self.bytes.as_chunks::<8>().0.split_at(1);
|
||||
[
|
||||
TEXT | self.len << 8 | (self.fg.raw() as usize) << 16,
|
||||
self.x.raw() as usize | (self.y.raw() as usize) << 16 | (self.bg.raw() as usize) << 32,
|
||||
self.x.raw() as usize
|
||||
| (self.y.raw() as usize) << 16
|
||||
| (self.bg.raw() as usize) << 32,
|
||||
u64::from_le_bytes(lo[0]) as usize,
|
||||
u64::from_le_bytes(hi[0]) as usize,
|
||||
]
|
||||
@@ -117,7 +126,13 @@ pub mod text {
|
||||
|
||||
#[test]
|
||||
fn text_round_trips() {
|
||||
let t = Text::new(ScreenCoord::new(1272), ScreenCoord::new(784), Color::rgb(1, 2, 3), Color::rgb(4, 5, 6), b"$ ls -la /home/x");
|
||||
let t = Text::new(
|
||||
ScreenCoord::new(1272),
|
||||
ScreenCoord::new(784),
|
||||
Color::rgb(1, 2, 3),
|
||||
Color::rgb(4, 5, 6),
|
||||
b"$ ls -la /home/x",
|
||||
);
|
||||
assert_eq!(Text::from_words(t.words()), Some(t));
|
||||
assert_eq!(Text::new(t.x, t.y, t.fg, t.bg, &[b'a'; 40]).len, TEXT_BYTES);
|
||||
}
|
||||
|
||||
@@ -19,4 +19,5 @@ pub mod spawn;
|
||||
pub mod start_arg;
|
||||
pub mod storage;
|
||||
pub mod syscall_abi;
|
||||
pub mod terminal;
|
||||
pub mod time;
|
||||
|
||||
7
crates/types/src/terminal.rs
Normal file
7
crates/types/src/terminal.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
//! The terminal's requests beyond text output, which is the log protocol
|
||||
//! (`types::log`): a program given the terminal as its log prints there.
|
||||
|
||||
/// Reply: the next chunk of a typed line as a text message (`types::log`);
|
||||
/// the line's last chunk ends with `\n`. Blocks until a line is entered.
|
||||
pub const READ: usize = 10;
|
||||
pub const CLEAR: usize = 11;
|
||||
Reference in New Issue
Block a user