Skip to content
Myr

Add `--ghost=TEXT` to display a ghost text when the input is empty

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 6c104d7 · Browse files · 5 files+44 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+44 added−0 removed

  • tests:+18 added−0 removed
  • other:+26 added−0 removed

5 files+44 added−0 removed

modified:man/man1/fzf.1+4 added
708 unmodified lines
709Do not display horizontal separator on the info line. A synonym for710\fB\-\-separator=''\fB711712.TP713.BI "\-\-ghost=" "TEXT"714Ghost text to display when the input is empty715716.TP717.B "\-\-filepath\-word"718Make word-wise movements and actions respect path separators. The following719actions are affected:720
1177 unmodified lines
modified:src/options.go+7 added
134 unmodified lines
135 --info-command=COMMAND Command to generate info line136 --separator=STR Draw horizontal separator on info line using the string137 (default: '─' or '-')138 --no-separator Hide info line separator139 --ghost=TEXT Ghost text to display when the input is empty140 --filepath-word Make word-wise movements respect path separators141 --input-border[=STYLE] Draw border around the input section142 [rounded|sharp|bold|block|thinblock|double|horizontal|vertical|143 top|bottom|left|right|none] (default: rounded)
430 unmodified lines
574 FileWord bool575 InfoStyle infoStyle576 InfoPrefix string577 InfoCommand string578 Ghost string579 Separator *string580 JumpLabels string581 Prompt string582 Pointer *string
107 unmodified lines
690 HscrollOff: 10,691 ScrollOff: 3,692 FileWord: false,693 InfoStyle: infoDefault,694 Ghost: "",695 Separator: nil,696 JumpLabels: defaultJumpLabels,697 Prompt: "> ",698 Pointer: nil,
1900 unmodified lines
2599 opts.Separator = &separator2600 case "--no-separator":2601 nosep := ""2602 opts.Separator = &nosep2603 case "--ghost":2604 if opts.Ghost, err = nextString("ghost text required"); err != nil {2605 return err2606 }2607 case "--scrollbar":2608 given, bar := optionalNextString()2609 if given {2610 opts.Scrollbar = &bar
874 unmodified lines
modified:src/terminal.go+7 added
232 unmodified lines
233 infoPrefix string234 wrap bool235 wrapSign string236 wrapSignWidth int237 ghost string238 separator labelPrinter239 separatorLen int240 spinner []string241 promptString string
605 unmodified lines
847 initDelay: delay,848 infoCommand: opts.InfoCommand,849 infoStyle: opts.InfoStyle,850 infoPrefix: opts.InfoPrefix,851 ghost: opts.Ghost,852 separator: nil,853 spinner: makeSpinner(opts.Unicode),854 promptString: opts.Prompt,855 queryLen: [2]int{0, 0},
1504 unmodified lines
2360 }2361 t.prompt()23622363 before, after := t.updatePromptOffset()2364 if len(before) == 0 && len(after) == 0 && len(t.ghost) > 0 {2365 w.CPrint(tui.ColInput.WithAttr(tui.Dim), t.ghost)2366 return2367 }23682369 color := tui.ColInput2370 if t.paused {2371 color = tui.ColDisabled2372 }
3932 unmodified lines
modified:test/test_core.rb+18 added
1811 unmodified lines
1812 # Last delimiter and the whitespaces are removed1813 assert_equal ['[0] 1st: foo, 3rd: baz, 2nd: bar'], File.readlines(tempname, chomp: true)1814 end1815 end18161817 def test_ghost1818 tmux.send_keys %(seq 100 | #{FZF} --prompt 'X ' --ghost 'Type in query ...'), :Enter1819 tmux.until do |lines|1820 assert_equal 100, lines.match_count1821 assert_includes lines, 'X Type in query ...'1822 end1823 tmux.send_keys '100'1824 tmux.until do |lines|1825 assert_equal 1, lines.match_count1826 assert_includes lines, 'X 100'1827 end1828 tmux.send_keys 'C-u'1829 tmux.until do |lines|1830 assert_equal 100, lines.match_count1831 assert_includes lines, 'X Type in query ...'1832 end1833 end1834end
modified:CHANGELOG.md+8 added
1CHANGELOG2=========340.61.05------6- Added `--ghost=TEXT` to display a ghost text when the input is empty7 ```sh8 # Display "Type to search" when the input is empty9 fzf --ghost "Type to search"10 ```11120.60.313------14- Bug fixes and improvements15 - [fish] Enable multiple history commands insertion (#4280) (@bitraid)
2584 unmodified lines