changing color parsing from \0 to \1a

This commit is contained in:
Able 2022-11-23 02:32:12 -06:00
parent 1f8ea529f9
commit 40c99b47b5
3 changed files with 47 additions and 31 deletions

View file

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

View file

@ -87,10 +87,10 @@ pub fn scratchpad() {
println!(
"{}
,-------. OS: \0BLUE\0AbleOS\0RESET\0
,'\\ _ _`. Host: \0PINK\0{}\0RESET\0
/ \\)_)-)_)-\\ Kernel: \0RED\0AKern-{}-v{}\0RESET\0
: : Uptime: \0GREEN\0{}\0RESET\0
,-------. OS: \u{001A}BLUE\u{001A}AbleOS\u{001A}RESET\u{001A}
,'\\ _ _`. Host: \u{001A}PINK\u{001A}{}\u{001A}RESET\u{001A}
/ \\)_)-)_)-\\ Kernel: \u{001A}RED\u{001A}AKern-{}-v{}\u{001A}RESET\u{001A}
: : Uptime: \u{001A}GREEN\u{001A}{}\u{001A}RESET\u{001A}
\\ / Packages: None
\\ / Shell: BuiltinShell
`. ,' Resolution: 640x480
@ -341,7 +341,11 @@ pub fn echo_file(path: String) {
Some(file) => {
trace!("checking is directory");
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 {
trace!("allocating buffer for file contents");
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,
x: 0,
back_buffer: [0; 640 * 480],
term: [('\0', Color16::DarkGrey); 80 * 60],
term: [('\u{001A}', Color16::DarkGrey); 80 * 60],
color: Color16::White,
}
}
@ -88,7 +88,7 @@ impl VTerm {
}
// trace!("C");
match c {
'\0' => {
'\u{001A}' => {
self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] =
(c, self.color);
self.x += 1;
@ -101,7 +101,7 @@ impl VTerm {
}
self.x -= 1;
self.term[TERM_MINUS_ONE_LINE + (self.x as usize)] =
('\0', Color16::LightGrey);
('\u{001A}', Color16::LightGrey);
}
'\n' => {
self.move_up();
@ -124,7 +124,7 @@ impl VTerm {
pub fn move_up(&mut self) {
self.term.rotate_left(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;
}
@ -211,40 +211,40 @@ enum Token {
#[error]
Error,
#[token("\0RESET\0", priority = 10)]
#[token("\u{001A}RESET\u{001A}", priority = 10)]
Reset,
#[token("\0BLACK\0", priority = 10)]
#[token("\u{001A}BLACK\u{001A}", priority = 10)]
TBlack,
#[regex("\0BLUE\0", priority = 10)]
#[regex("\u{001A}BLUE\u{001A}", priority = 10)]
TBlue,
#[token("\0GREEN\0", priority = 10)]
#[token("\u{001A}GREEN\u{001A}", priority = 10)]
TGreen,
#[token("\0CYAN\0", priority = 10)]
#[token("\u{001A}CYAN\u{001A}", priority = 10)]
TCyan,
#[token("\0RED\0", priority = 10)]
#[token("\u{001A}RED\u{001A}", priority = 10)]
TRed,
#[token("\0MAGENTA\0", priority = 10)]
#[token("\u{001A}MAGENTA\u{001A}", priority = 10)]
TMagenta,
#[token("\0BROWN\0", priority = 10)]
#[token("\u{001A}BROWN\u{001A}", priority = 10)]
TBrown,
#[token("\0LIGHTGREY\0", priority = 10)]
#[token("\u{001A}LIGHTGREY\u{001A}", priority = 10)]
TLightGrey,
#[token("\0DARKGREY\0", priority = 10)]
#[token("\u{001A}DARKGREY\u{001A}", priority = 10)]
TDarkGrey,
#[token("\0LIGHTBLUE\0", priority = 10)]
#[token("\u{001A}LIGHTBLUE\u{001A}", priority = 10)]
TLightBlue,
#[token("\0LIGHTGREEN\0", priority = 10)]
#[token("\u{001A}LIGHTGREEN\u{001A}", priority = 10)]
TLightGreen,
#[token("\0LIGHTCYAN\0", priority = 10)]
#[token("\u{001A}LIGHTCYAN\u{001A}", priority = 10)]
TLightCyan,
#[token("\0LIGHTRED\0", priority = 10)]
#[token("\u{001A}LIGHTRED\u{001A}", priority = 10)]
TLightRed,
#[token("\0PINK\0", priority = 10)]
#[token("\u{001A}PINK\u{001A}", priority = 10)]
TPink,
#[token("\0YELLOW\0", priority = 10)]
#[token("\u{001A}YELLOW\u{001A}", priority = 10)]
TYellow,
#[token("\0WHITE\0", priority = 10)]
#[token("\u{001A}WHITE\u{001A}", priority = 10)]
TWhite,
// #[token(" ")]