1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 16:16:16 +04:00

Fix wrong display in console driver

This commit is contained in:
equation314 2019-05-08 00:04:41 +08:00
parent 03a8b3e449
commit 2fb09109bb
3 changed files with 14 additions and 5 deletions

View File

@ -78,5 +78,10 @@ pub fn probe_fb_info(width: u32, height: u32, depth: u32) -> FramebufferResult {
))?;
}
Ok((info, fb::ColorConfig::BGRA8888, vaddr))
let color_config = match info.depth {
16 => ColorConfig::RGB565,
32 => ColorConfig::BGRA8888,
_ => Err(format!("unsupported color depth {}", info.depth))?,
};
Ok((info, color_config, vaddr))
}

View File

@ -28,7 +28,7 @@ pub struct ConsoleChar {
impl Default for ConsoleChar {
fn default() -> Self {
ConsoleChar {
ascii_char: 0,
ascii_char: b' ',
attr: CharacterAttribute::default(),
}
}
@ -152,7 +152,7 @@ impl<F: Font> Console<F> {
fn new_line(&mut self) {
let attr_blank = ConsoleChar {
ascii_char: 0,
ascii_char: b' ',
attr: self.parser.char_attribute(),
};
for j in self.col..self.buf.num_col {

View File

@ -156,8 +156,12 @@ impl EscapeParser {
}
let csi = CSI::new(byte, &self.params);
if csi == CSI::SGR {
for &param in self.params.iter() {
self.char_attr.apply_sgr(param);
if self.params.is_empty() {
self.char_attr.apply_sgr(0);
} else {
for &param in self.params.iter() {
self.char_attr.apply_sgr(param);
}
}
}
self.status = ParseStatus::Text;