Fix wrong display in console driver

toolchain_update
equation314 6 years ago
parent 03a8b3e449
commit 2fb09109bb

@ -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))
} }

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

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

Loading…
Cancel
Save