mirror of
https://git.2ki.xyz/spiders/kijetesantakaluotokieni.git
synced 2024-11-22 09:50:25 +01:00
added the ability for custom borders to actually affect the bubble output
This commit is contained in:
parent
46af7774a5
commit
6e0aeb53e7
2 changed files with 27 additions and 7 deletions
|
@ -42,6 +42,7 @@ impl BubbleConfig {
|
||||||
middle_right: "|".to_string(),
|
middle_right: "|".to_string(),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
//
|
||||||
let left = if let Some(item) = chars.get(1) {
|
let left = if let Some(item) = chars.get(1) {
|
||||||
item.to_string()
|
item.to_string()
|
||||||
} else {
|
} else {
|
||||||
|
@ -145,12 +146,22 @@ impl BubbleConfig {
|
||||||
};
|
};
|
||||||
|
|
||||||
let bubble_top = manipulate::pad_left(
|
let bubble_top = manipulate::pad_left(
|
||||||
&format!(" _{}_ \n", "_".repeat(line_length)),
|
&format!(
|
||||||
|
" {}{}{} \n",
|
||||||
|
self.top,
|
||||||
|
self.top.repeat(line_length),
|
||||||
|
self.top
|
||||||
|
),
|
||||||
left_pad_length,
|
left_pad_length,
|
||||||
" ",
|
" ",
|
||||||
);
|
);
|
||||||
let bubble_bottom = manipulate::pad_left(
|
let bubble_bottom = manipulate::pad_left(
|
||||||
&format!(" -{}- ", "-".repeat(line_length)),
|
&format!(
|
||||||
|
" {}{}{} ",
|
||||||
|
self.bottom,
|
||||||
|
self.bottom.repeat(line_length),
|
||||||
|
self.bottom
|
||||||
|
),
|
||||||
left_pad_length,
|
left_pad_length,
|
||||||
" ",
|
" ",
|
||||||
);
|
);
|
||||||
|
@ -161,27 +172,36 @@ impl BubbleConfig {
|
||||||
return format!(
|
return format!(
|
||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
bubble_top,
|
bubble_top,
|
||||||
manipulate::pad_left(&format!("< {} >\n", lines[0]), left_pad_length, " "),
|
manipulate::pad_left(
|
||||||
|
&format!("{} {} {}\n", self.left, lines[0], self.right),
|
||||||
|
left_pad_length,
|
||||||
|
" "
|
||||||
|
),
|
||||||
bubble_bottom
|
bubble_bottom
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
n => {
|
n => {
|
||||||
bubble_body.push_str(&manipulate::pad_left(
|
bubble_body.push_str(&manipulate::pad_left(
|
||||||
&format!("/ {} \\\n", lines[0]),
|
&format!("{} {} {}\n", self.top_left, lines[0], self.top_right),
|
||||||
left_pad_length,
|
left_pad_length,
|
||||||
" ",
|
" ",
|
||||||
));
|
));
|
||||||
if n > 2 {
|
if n > 2 {
|
||||||
for i in 1..n - 1 {
|
for i in 1..n - 1 {
|
||||||
bubble_body.push_str(&manipulate::pad_left(
|
bubble_body.push_str(&manipulate::pad_left(
|
||||||
&format!("| {} |\n", lines[i]),
|
&format!("{} {} {}\n", self.middle_left, lines[i], self.middle_right),
|
||||||
left_pad_length,
|
left_pad_length,
|
||||||
" ",
|
" ",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bubble_body.push_str(&manipulate::pad_left(
|
bubble_body.push_str(&manipulate::pad_left(
|
||||||
&format!("\\ {} /\n", lines[n - 1]),
|
&format!(
|
||||||
|
"{} {} {}\n",
|
||||||
|
self.bottom_left,
|
||||||
|
lines[n - 1],
|
||||||
|
self.bottom_right
|
||||||
|
),
|
||||||
left_pad_length,
|
left_pad_length,
|
||||||
" ",
|
" ",
|
||||||
));
|
));
|
||||||
|
|
|
@ -189,7 +189,7 @@ impl Args {
|
||||||
let bubble_config = BubbleConfig::config_from_string(
|
let bubble_config = BubbleConfig::config_from_string(
|
||||||
critter_config.template.anchor,
|
critter_config.template.anchor,
|
||||||
DEFAULT_MAXIMUM_LINE_LENGTH,
|
DEFAULT_MAXIMUM_LINE_LENGTH,
|
||||||
None,
|
Some("".to_string()),
|
||||||
);
|
);
|
||||||
|
|
||||||
(critter_config, bubble_config)
|
(critter_config, bubble_config)
|
||||||
|
|
Loading…
Reference in a new issue