Prevent variable selection content from being limited to 3 columns (#821)

This commit is contained in:
Denis Isidoro 2023-04-08 21:13:27 -03:00 committed by GitHub
parent 8963749e6a
commit f6414551bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View file

@ -101,6 +101,7 @@ fn prompt_finder(
let mut opts = FinderOpts { let mut opts = FinderOpts {
preview: Some(preview), preview: Some(preview),
show_all_columns: true,
..initial_opts.clone().unwrap_or_else(FinderOpts::var_default) ..initial_opts.clone().unwrap_or_else(FinderOpts::var_default)
}; };

View file

@ -75,8 +75,6 @@ impl FinderChoice {
"", "",
"--preview-window", "--preview-window",
format!("up:{}:nohidden", preview_height).as_str(), format!("up:{}:nohidden", preview_height).as_str(),
"--with-nth",
"1,2,3",
"--delimiter", "--delimiter",
deser::terminal::DELIMITER.to_string().as_str(), deser::terminal::DELIMITER.to_string().as_str(),
"--ansi", "--ansi",
@ -85,6 +83,10 @@ impl FinderChoice {
"--exact", "--exact",
]); ]);
if !opts.show_all_columns {
command.args(["--with-nth", "1,2,3"]);
}
if !opts.prevent_select1 { if !opts.prevent_select1 {
if let Self::Fzf = self { if let Self::Fzf = self {
command.arg("--select-1"); command.arg("--select-1");

View file

@ -16,6 +16,7 @@ pub struct Opts {
pub column: Option<u8>, pub column: Option<u8>,
pub map: Option<String>, pub map: Option<String>,
pub prevent_select1: bool, pub prevent_select1: bool,
pub show_all_columns: bool,
} }
impl Default for Opts { impl Default for Opts {
@ -34,6 +35,7 @@ impl Default for Opts {
delimiter: None, delimiter: None,
map: None, map: None,
prevent_select1: true, prevent_select1: true,
show_all_columns: false,
} }
} }
} }