fixed alignment bug, removed test print

This commit is contained in:
spiders 2022-05-02 16:25:10 -07:00
parent 1b05a7c4bf
commit 159924dffc
2 changed files with 16 additions and 4 deletions

View file

@ -44,13 +44,25 @@ fn bubble_from_lines(lines: Vec<String>, min_length: usize) -> String {
) )
} }
n => { n => {
bubble_body.push_str(&format!("/ {:<line_length$} \\\n", lines[0])); bubble_body.push_str(&manipulate::pad_left(
&format!("/ {} \\\n", lines[0]),
pad_length,
" ",
));
if n > 2 { if n > 2 {
for i in 1..n - 1 { for i in 1..n - 1 {
bubble_body.push_str(&format!("| {:<line_length$} |\n", lines[i])); bubble_body.push_str(&manipulate::pad_left(
&format!("| {} |\n", lines[i]),
pad_length,
" ",
));
} }
} }
bubble_body.push_str(&format!("\\ {:<line_length$} /\n", lines[n - 1])); bubble_body.push_str(&manipulate::pad_left(
&format!("\\ {} /\n", lines[n - 1]),
pad_length,
" ",
));
return format!("{}{}{}", bubble_top, bubble_body, bubble_bottom); return format!("{}{}{}", bubble_top, bubble_body, bubble_bottom);
} }
} }

View file

@ -3,6 +3,7 @@ TO DO
- kijefiles - kijefiles
- other aminals - other aminals
- pakala - pakala
- pilin
*/ */
mod bubbles; mod bubbles;
@ -28,7 +29,6 @@ fn main() {
.expect("failed to read input"); .expect("failed to read input");
} }
output(&text, config); output(&text, config);
println!("{}test{}", FourBit::BrightCyan.escape(false), kule::reset());
} }
#[derive(Parser, Debug)] #[derive(Parser, Debug)]