From 41aa47e280db40c6592183e598b4533f9d313d56 Mon Sep 17 00:00:00 2001 From: Fulvio Scapin Date: Thu, 11 Aug 2022 16:47:11 +0200 Subject: [PATCH] Fix preview map "leaking" with multiple variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/commands/preview/var.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/commands/preview/var.rs b/src/commands/preview/var.rs index 8dd809b..14880bf 100644 --- a/src/commands/preview/var.rs +++ b/src/commands/preview/var.rs @@ -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() + } ); }