changing color parsing from \0 to \1a

master
Able 2022-11-23 02:32:12 -06:00
parent 25c2a72fd1
commit 7aee7ab371
Signed by untrusted user: able
GPG Key ID: 0BD8B45C30DCA887
3 changed files with 47 additions and 31 deletions

View File

@ -7,10 +7,10 @@ enabled = true
level = "Trace" level = "Trace"
log_to_serial = true log_to_serial = true
log_to_vterm = false log_to_vterm = false
filter = ["ableos::ps2_mouse", "ableos::vterm", "ableos::filesystem::vfs"]
# Exact paths required # Exact paths required
filter = ["ableos::ps2_mouse", "ableos::vterm"]
[tests] [tests]
run_tests = false run_tests = false
run_demos = false run_demos = false

View File

@ -87,10 +87,10 @@ pub fn scratchpad() {
println!( println!(
"{} "{}
,-------. OS: \0BLUE\0AbleOS\0RESET\0 ,-------. OS: \u{001A}BLUE\u{001A}AbleOS\u{001A}RESET\u{001A}
,'\\ _ _`. Host: \0PINK\0{}\0RESET\0 ,'\\ _ _`. Host: \u{001A}PINK\u{001A}{}\u{001A}RESET\u{001A}
/ \\)_)-)_)-\\ Kernel: \0RED\0AKern-{}-v{}\0RESET\0 / \\)_)-)_)-\\ Kernel: \u{001A}RED\u{001A}AKern-{}-v{}\u{001A}RESET\u{001A}
: : Uptime: \0GREEN\0{}\0RESET\0 : : Uptime: \u{001A}GREEN\u{001A}{}\u{001A}RESET\u{001A}
\\ / Packages: None \\ / Packages: None
\\ / Shell: BuiltinShell \\ / Shell: BuiltinShell
`. ,' Resolution: 640x480 `. ,' Resolution: 640x480
@ -341,7 +341,11 @@ pub fn echo_file(path: String) {
Some(file) => { Some(file) => {
trace!("checking is directory"); trace!("checking is directory");
if file.is_dir() { if file.is_dir() {
println!("{} is a directory", path); println!(
"\u{001A}RED\u{001A}ERROR\u{001A}RESET\u{001A} {} is a directory",
path
);
error!("{} is a directory", path);
} else { } else {
trace!("allocating buffer for file contents"); trace!("allocating buffer for file contents");
let mut file_contents = Vec::new(); let mut file_contents = Vec::new();
@ -353,9 +357,21 @@ pub fn echo_file(path: String) {
} }
} }
None => todo!(), None => {
error!("File {} doesn't exist", path);
println!(
"\u{001A}RED\u{001A}ERROR\u{001A}RESET\u{001A}: File {} doesn't exist",
path
);
}
} }
} }
Err(err) => error!("path {} Error {}", path, err), Err(err) => {
println!(
"\u{001A}RED\u{001A}ERROR\u{001A}RESET\u{001A}: path {} Error {}",
path, err
);
error!("path {} Error {}", path, err);
}
} }
} }

View File

@ -36,7 +36,7 @@ impl VTerm {
dirty: false, dirty: false,
x: 0, x: 0,
back_buffer: [0; 640 * 480], back_buffer: [0; 640 * 480],
term: [('\0', Color16::DarkGrey); 80 * 60], term: [('\u{001A}', Color16::DarkGrey); 80 * 60],
color: Color16::White, color: Color16::White,
} }
} }
@ -88,7 +88,7 @@ impl VTerm {
} }
// trace!("C"); // trace!("C");
match c { match c {
'\0' => { '\u{001A}' => {
self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] = self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] =
(c, self.color); (c, self.color);
self.x += 1; self.x += 1;
@ -101,7 +101,7 @@ impl VTerm {
} }
self.x -= 1; self.x -= 1;
self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] = self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] =
('\0', Color16::LightGrey); ('\u{001A}', Color16::LightGrey);
} }
'\n' => { '\n' => {
self.move_up(); self.move_up();
@ -124,7 +124,7 @@ impl VTerm {
pub fn move_up(&mut self) { pub fn move_up(&mut self) {
self.term.rotate_left(80); self.term.rotate_left(80);
for x in 0..80 { for x in 0..80 {
self.term[TERM_MINUS_ONE_LINE + x] = ('\0', Color16::DarkGrey); self.term[TERM_MINUS_ONE_LINE + x] = ('\u{001A}', Color16::DarkGrey);
} }
self.x = 0; self.x = 0;
} }
@ -211,40 +211,40 @@ enum Token {
#[error] #[error]
Error, Error,
#[token("\0RESET\0", priority = 10)] #[token("\u{001A}RESET\u{001A}", priority = 10)]
Reset, Reset,
#[token("\0BLACK\0", priority = 10)] #[token("\u{001A}BLACK\u{001A}", priority = 10)]
TBlack, TBlack,
#[regex("\0BLUE\0", priority = 10)] #[regex("\u{001A}BLUE\u{001A}", priority = 10)]
TBlue, TBlue,
#[token("\0GREEN\0", priority = 10)] #[token("\u{001A}GREEN\u{001A}", priority = 10)]
TGreen, TGreen,
#[token("\0CYAN\0", priority = 10)] #[token("\u{001A}CYAN\u{001A}", priority = 10)]
TCyan, TCyan,
#[token("\0RED\0", priority = 10)] #[token("\u{001A}RED\u{001A}", priority = 10)]
TRed, TRed,
#[token("\0MAGENTA\0", priority = 10)] #[token("\u{001A}MAGENTA\u{001A}", priority = 10)]
TMagenta, TMagenta,
#[token("\0BROWN\0", priority = 10)] #[token("\u{001A}BROWN\u{001A}", priority = 10)]
TBrown, TBrown,
#[token("\0LIGHTGREY\0", priority = 10)] #[token("\u{001A}LIGHTGREY\u{001A}", priority = 10)]
TLightGrey, TLightGrey,
#[token("\0DARKGREY\0", priority = 10)] #[token("\u{001A}DARKGREY\u{001A}", priority = 10)]
TDarkGrey, TDarkGrey,
#[token("\0LIGHTBLUE\0", priority = 10)] #[token("\u{001A}LIGHTBLUE\u{001A}", priority = 10)]
TLightBlue, TLightBlue,
#[token("\0LIGHTGREEN\0", priority = 10)] #[token("\u{001A}LIGHTGREEN\u{001A}", priority = 10)]
TLightGreen, TLightGreen,
#[token("\0LIGHTCYAN\0", priority = 10)] #[token("\u{001A}LIGHTCYAN\u{001A}", priority = 10)]
TLightCyan, TLightCyan,
#[token("\0LIGHTRED\0", priority = 10)] #[token("\u{001A}LIGHTRED\u{001A}", priority = 10)]
TLightRed, TLightRed,
#[token("\0PINK\0", priority = 10)] #[token("\u{001A}PINK\u{001A}", priority = 10)]
TPink, TPink,
#[token("\0YELLOW\0", priority = 10)] #[token("\u{001A}YELLOW\u{001A}", priority = 10)]
TYellow, TYellow,
#[token("\0WHITE\0", priority = 10)] #[token("\u{001A}WHITE\u{001A}", priority = 10)]
TWhite, TWhite,
// #[token(" ")] // #[token(" ")]