diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2025-03-14 16:46:23 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2025-03-14 16:46:23 +0900 |
| commit | 4298c0b1eb31b7563eb608e3fbf4069488ada08d (patch) | |
| tree | abca5dae422106c0ccc59e0070a9383995330777 /src/terminal.go | |
| parent | 6c104d771e382f499025a35b10f39d997ce83b7d (diff) | |
| download | fzf-4298c0b1eb31b7563eb608e3fbf4069488ada08d.tar.gz | |
Add `--ghost=TEXT` to display a ghost text when the input is empty
Diffstat (limited to 'src/terminal.go')
| -rw-r--r-- | src/terminal.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/terminal.go b/src/terminal.go index 19230a9d..8f8b800a 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -234,6 +234,7 @@ type Terminal struct { wrap bool wrapSign string wrapSignWidth int + ghost string separator labelPrinter separatorLen int spinner []string @@ -847,6 +848,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox, executor *util.Executor infoCommand: opts.InfoCommand, infoStyle: opts.InfoStyle, infoPrefix: opts.InfoPrefix, + ghost: opts.Ghost, separator: nil, spinner: makeSpinner(opts.Unicode), promptString: opts.Prompt, @@ -2359,6 +2361,11 @@ func (t *Terminal) printPrompt() { t.prompt() before, after := t.updatePromptOffset() + if len(before) == 0 && len(after) == 0 && len(t.ghost) > 0 { + w.CPrint(tui.ColInput.WithAttr(tui.Dim), t.ghost) + return + } + color := tui.ColInput if t.paused { color = tui.ColDisabled |
