Skip to content

Commit

Permalink
feat(explain): quote module values (starship#2931)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkna authored Jul 30, 2021
1 parent af43aee commit 66159cd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ pub fn timings(args: ArgMatches) {
println!("\n Here are the timings of modules in your prompt (>=1ms or output):");

// for now we do not expect a wrap around at the end... famous last words
// Overall a line looks like this: " {module name} - {duration} - {module value}".
// Overall a line looks like this: " {module name} - {duration} - "{module value}"".
for timing in &modules {
println!(
" {}{} - {}{} - {}",
" {}{} - {}{} - \"{}\"",
timing.name,
" ".repeat(max_name_width - (timing.name_len)),
" ".repeat(max_duration_width - (timing.duration_len)),
Expand Down Expand Up @@ -221,9 +221,9 @@ pub fn explain(args: ArgMatches) {

let max_module_width = modules.iter().map(|i| i.value_len).max().unwrap_or(0);

// In addition to the module width itself there are also 9 padding characters in each line.
// Overall a line looks like this: " {module value} ({xxxms}) - {description}".
const PADDING_WIDTH: usize = 9;
// In addition to the module width itself there are also 11 padding characters in each line.
// Overall a line looks like this: " "{module value}" ({xxxms}) - {description}".
const PADDING_WIDTH: usize = 11;

let desc_width = term_size::dimensions()
.map(|(w, _)| w)
Expand All @@ -238,7 +238,7 @@ pub fn explain(args: ArgMatches) {
let mut escaping = false;
// Print info
print!(
" {} ({}){} - ",
" \"{}\" ({}){} - ",
info.value,
info.duration,
" ".repeat(max_module_width - (info.value_len))
Expand Down

0 comments on commit 66159cd

Please sign in to comment.