summaryrefslogtreecommitdiff
path: root/src/options.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-23 01:39:57 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-23 01:39:57 +0900
commit06547d0cbe82f516904a54579a73fa01b1bb64bf (patch)
treeee995c72623f8bf51031811029885e30f5d66bdd /src/options.go
parent578108280e081c9996eb7df578aac4e1dd1a6f94 (diff)
downloadfzf-06547d0cbe82f516904a54579a73fa01b1bb64bf.tar.gz
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
Diffstat (limited to 'src/options.go')
-rw-r--r--src/options.go17
1 files changed, 17 insertions, 0 deletions
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 {