Skip to content

Commit

Permalink
Fix preview map "leaking" with multiple variables
Browse files Browse the repository at this point in the history
With multiple variables in the preview, each with
different «--map» options, there is an application
of the map code for the current variable to the
preview of the other variables as well.
This code fixes that.
  • Loading branch information
trantor committed Aug 21, 2022
1 parent 9d86234 commit 41aa47e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/commands/preview/var.rs
Expand Up @@ -90,8 +90,14 @@ impl Runnable for Input {
"{variables}\n{variable} = {value}",
variables = variables,
variable = style(variable_name).with(variable_color),
value = finder::process(value, column, delimiter.as_deref(), map.clone())
.expect("Unable to process value"),
value = if env_var::get(&env_variable_name).is_ok() {
value
} else if is_current {
finder::process(value, column, delimiter.as_deref(), map.clone())
.expect("Unable to process value")
} else {
"".to_string()
}
);
}

Expand Down

0 comments on commit 41aa47e

Please sign in to comment.