Repository: denisidoro/navi
File: src/finder/mod.rs (Rust)

Code before:
        let preview_height = match self {
            FinderChoice::Skim => 3,
            _ => 2,
        };

        let bindings = if opts.suggestion_type == SuggestionType::MultipleSelections {
            ",ctrl-r:toggle-all"
        } else {
            ""
        };

        command.args([
            "--preview",
            "",
            "--preview-window",
            format!("up:{preview_height}:nohidden").as_str(),
            "--delimiter",
            deser::terminal::DELIMITER.to_string().as_str(),
            "--ansi",
            "--bind",
            format!("ctrl-j:down,ctrl-k:up{bindings}").as_str(),
            "--exact",
        ]);

        if !opts.show_all_columns {
            command.args(["--read0", "--print0", "--with-nth", "1"]);
        }

        if !opts.prevent_select1 {
            if let Self::Fzf = self {
                command.arg("--select-1");
            }
        }

        match opts.suggestion_type {
            SuggestionType::MultipleSelections => {
                command.arg("--multi");
            }
            SuggestionType::Disabled => {
                if let Self::Fzf = self {
                    command.args(["--print-query", "--no-select-1"]);
                };
            }
            SuggestionType::SnippetSelection => {
                command.args(["--expect", "ctrl-y,ctrl-o,enter"]);
            }
            SuggestionType::SingleRecommendation => {
                command.args(["--print-query", "--expect", "tab,enter"]);
            }
            _ => {}
        }

Review comment (suggestion):
It is better to rename `show_all_columns` or introduce another option for `--read0` and `--print0` because `--read0` and `--print0` do not control the number of columns to display.


Code after:
        let preview_height = match self {
            FinderChoice::Skim => 3,
            _ => 2,
        };

        let bindings = if opts.suggestion_type == SuggestionType::MultipleSelections {
            ",ctrl-r:toggle-all"
        } else {
            ""
        };

        command.args([
            "--preview",
            "",
            "--preview-window",
            format!("up:{preview_height}:nohidden").as_str(),
            "--delimiter",
            deser::terminal::DELIMITER.to_string().as_str(),
            "--ansi",
            "--bind",
            format!("ctrl-j:down,ctrl-k:up{bindings}").as_str(),
            "--exact",
        ]);

        if !opts.show_all_columns {
            let with_nth = if CONFIG.multiline() { "1" } else { "1,2,3" };
            command.args(["--read0", "--print0", "--with-nth", with_nth]);
        }

        if !opts.prevent_select1 {
            if let Self::Fzf = self {
                command.arg("--select-1");
            }
        }

        match opts.suggestion_type {
            SuggestionType::MultipleSelections => {
                command.arg("--multi");
            }
            SuggestionType::Disabled => {
                if let Self::Fzf = self {
                    command.args(["--print-query", "--no-select-1"]);
                };
            }
            SuggestionType::SnippetSelection => {
                command.args(["--expect", "ctrl-y,ctrl-o,enter"]);
            }
            SuggestionType::SingleRecommendation => {
                command.args(["--print-query", "--expect", "tab,enter"]);
            }
            _ => {}