summaryrefslogtreecommitdiff
path: root/src/options.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-30 00:50:46 +0900
committerGitHub <noreply@github.com>2025-01-30 00:50:46 +0900
commit6c0ca4a64a4e2f8697dfa830dcae56c1d7ddca51 (patch)
treeb3cb6eefec8009c815d0ce0a4bea3032f8bc0cf8 /src/options.go
parent6b5d4614114f1a7a34a50c21ed2952f94a5ee81e (diff)
downloadfzf-6c0ca4a64a4e2f8697dfa830dcae56c1d7ddca51.tar.gz
Add --no-input to hide the input section (#4210)
Close #2890 Close #1396 You can't type in queries in this mode, and the only way to trigger an fzf search is to use `search(...)` action. # Click header to trigger search fzf --header '[src] [test]' --no-input --layout reverse \ --header-border bottom --input-border \ --bind 'click-header:transform-search:echo ${FZF_CLICK_HEADER_WORD:1:-1}'
Diffstat (limited to 'src/options.go')
-rw-r--r--src/options.go19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/options.go b/src/options.go
index cc627ee1..fec9596c 100644
--- a/src/options.go
+++ b/src/options.go
@@ -127,6 +127,7 @@ Usage: fzf [options]
(default: 0 or center)
INPUT SECTION
+ --no-input Disable and hide the input section
--prompt=STR Input prompt (default: '> ')
--info=STYLE Finder info style
[default|right|hidden|inline[-right][:PREFIX]]
@@ -538,6 +539,7 @@ type Options struct {
Scheme string
Extended bool
Phony bool
+ Inputless bool
Case Case
Normalize bool
Nth []Range
@@ -659,6 +661,7 @@ func defaultOptions() *Options {
Scheme: "", // Unknown
Extended: true,
Phony: false,
+ Inputless: false,
Case: CaseSmart,
Normalize: true,
Nth: make([]Range, 0),
@@ -2315,6 +2318,8 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
opts.Phony = false
case "--disabled", "--phony":
opts.Phony = true
+ case "--no-input":
+ opts.Inputless = true
case "--tiebreak":
str, err := nextString("sort criterion required")
if err != nil {
@@ -3064,6 +3069,9 @@ func noSeparatorLine(style infoStyle, separator bool) bool {
}
func (opts *Options) noSeparatorLine() bool {
+ if opts.Inputless {
+ return true
+ }
sep := opts.Separator == nil && !opts.InputBorderShape.Visible() || opts.Separator != nil && len(*opts.Separator) > 0
return noSeparatorLine(opts.InfoStyle, sep)
}
@@ -3235,7 +3243,13 @@ func postProcessOptions(opts *Options) error {
// Sets --min-height automatically
if opts.Height.size > 0 && opts.Height.percent && opts.MinHeight < 0 {
- opts.MinHeight = -opts.MinHeight + 1 + borderLines(opts.BorderShape) + borderLines(opts.ListBorderShape) + borderLines(opts.InputBorderShape)
+ opts.MinHeight = -opts.MinHeight + borderLines(opts.BorderShape) + borderLines(opts.ListBorderShape)
+ if !opts.Inputless {
+ opts.MinHeight += 1 + borderLines(opts.InputBorderShape)
+ if !opts.noSeparatorLine() {
+ opts.MinHeight++
+ }
+ }
if len(opts.Header) > 0 {
opts.MinHeight += borderLines(opts.HeaderBorderShape) + len(opts.Header)
}
@@ -3246,9 +3260,6 @@ func postProcessOptions(opts *Options) error {
}
opts.MinHeight += borderLines(borderShape) + opts.HeaderLines
}
- if !opts.noSeparatorLine() {
- opts.MinHeight++
- }
if len(opts.Preview.command) > 0 && (opts.Preview.position == posUp || opts.Preview.position == posDown) && opts.Preview.Visible() && opts.Preview.position == posUp {
borderShape := opts.Preview.border
if opts.Preview.border == tui.BorderLine {