From 06547d0cbe82f516904a54579a73fa01b1bb64bf Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 23 Jan 2025 01:39:57 +0900 Subject: Add --header-lines-border to separate two headers Examples: # Border only around the header from --header-lines seq 10 | fzf --header 'hello' --header-lines 2 --header-lines-border # Both headers with borders seq 10 | fzf --header 'hello' --header-lines 2 --header-border --header-lines-border # Use 'none' to still separate two headers but without a border seq 10 | fzf --header 'hello' --header-lines 2 --header-border --header-lines-border none --list-border --- src/options.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/options.go') diff --git a/src/options.go b/src/options.go index 2168284b..4b5b25fa 100644 --- a/src/options.go +++ b/src/options.go @@ -164,6 +164,9 @@ Usage: fzf [options] --header-border[=STYLE] Draw border around the header section [rounded|sharp|bold|block|thinblock|double|horizontal|vertical| top|bottom|left|right|none] (default: rounded) + --header-lines-border[=STYLE] + Display header from --header-lines with a separate border. + Pass 'none' to still separate it but without a border. --header-label=LABEL Label to print on the header border --header-label-pos=COL Position of the header label [POSITIVE_INTEGER: columns from left| @@ -597,6 +600,7 @@ type Options struct { ListBorderShape tui.BorderShape InputBorderShape tui.BorderShape HeaderBorderShape tui.BorderShape + HeaderLinesShape tui.BorderShape InputLabel labelOpts HeaderLabel labelOpts BorderLabel labelOpts @@ -2669,6 +2673,13 @@ func parseOptions(index *int, opts *Options, allArgs []string) error { if opts.HeaderBorderShape, err = parseBorder(arg, !hasArg, false); err != nil { return err } + case "--no-header-lines-border": + opts.HeaderLinesShape = tui.BorderNone + case "--header-lines-border": + hasArg, arg := optionalNextString() + if opts.HeaderLinesShape, err = parseBorder(arg, !hasArg, false); err != nil { + return err + } case "--no-header-label": opts.HeaderLabel.label = "" case "--header-label": @@ -3016,6 +3027,12 @@ func postProcessOptions(opts *Options) error { opts.HeaderBorderShape = tui.BorderNone } + if opts.HeaderLinesShape == tui.BorderNone { + opts.HeaderLinesShape = tui.BorderPhantom + } else if opts.HeaderLinesShape == tui.BorderUndefined { + opts.HeaderLinesShape = tui.BorderNone + } + if opts.Pointer == nil { defaultPointer := "▌" if !opts.Unicode { -- cgit v1.2.3