[O] Draw from the first non-space

This commit is contained in:
Azalea Gui
2023-03-08 23:55:31 -05:00
parent f9017405a1
commit 5ffa793d7c
+2
View File
@@ -242,8 +242,10 @@ impl Mutes {
fn print_ascii(&mut self, art: &AsciiArt, x: u16, y: u16, color: &'static str) { fn print_ascii(&mut self, art: &AsciiArt, x: u16, y: u16, color: &'static str) {
// Loop through all lines in the ascii art // Loop through all lines in the ascii art
for (i, line) in art.art.lines().enumerate() { for (i, line) in art.art.lines().enumerate() {
let first_non_space = line.chars().position(|c| c != ' ').unwrap_or(0);
// Loop through all characters in the line // Loop through all characters in the line
for (j, c) in line.chars().enumerate() { for (j, c) in line.chars().enumerate() {
if j < first_non_space { continue; }
// Draw the character in the buffer // Draw the character in the buffer
let x = x + j as u16; let x = x + j as u16;
let y = y + i as u16; let y = y + i as u16;