Commit Graph

1142 Commits

Author SHA1 Message Date
Junegunn Choi
e0ddb97ab4
Improved --sync behavior
When --sync is provided, fzf will not render the interface until the
initial filtering and associated actions (bound to any of 'start',
'load', or 'result') are complete.
2024-06-17 00:11:57 +09:00
Junegunn Choi
6de0a7ddc1
--sync: Do not start TUI until initial filtering is complete 2024-06-15 10:46:28 +09:00
Junegunn Choi
b2ecb6352c
Make GET endpoint available from 'execute' and 'transform' actions 2024-06-14 21:33:42 +09:00
Junegunn Choi
9dc3ed638a
--walker-skip should also handle symlinks to directories
Fix #3858
2024-06-13 22:55:31 +09:00
Junegunn Choi
dca2262fe6
Prefer LightRenderer over tcell on Windows
For mouse support on mintty

Fix #3847
2024-06-12 21:53:18 +09:00
Junegunn Choi
0684a20ea3
Fix invalid mouse offset for --height on Windows 2024-06-12 21:18:02 +09:00
Junegunn Choi
a1a72bb8d1
Do not open tmux or winpty in --filter mode 2024-06-12 21:02:48 +09:00
Junegunn Choi
7fc13c5cfd
Less aggressive chunk cache invalidation for --tail 2024-06-10 20:33:55 +09:00
Junegunn Choi
dfee7af57b
Fix divide by zero error with --tiebreak=end for long items
Fix #3846
2024-06-10 08:26:53 +09:00
Junegunn Choi
590060a16b
Remove unused field 2024-06-07 17:05:33 +09:00
Junegunn Choi
368294edf6
Reduce flickering of the list when the list is truncated by --tail 2024-06-07 16:59:09 +09:00
Junegunn Choi
b1460d4787
hasPreviewFlags should ignore escaped placeholder
This reload command wouldn't run before the fix:

  : | fzf --bind 'start:reload:echo \{}'
2024-06-06 17:40:15 +09:00
Junegunn Choi
1616ed543d
Fix index out of bounds error caused by outdated offset 2024-06-06 00:23:58 +09:00
Junegunn Choi
ef148dfd37
Handle int32 overflow
yes | fzf --tail=10 --preview 'echo "{n}"'
2024-06-05 14:29:50 +09:00
Junegunn Choi
93bbb3032d
Add --tail=NUM to limit the number of items to keep in memory 2024-06-04 17:50:46 +09:00
Junegunn Choi
c29533994f
Fix invalid default of selected-hl (--color)
It should default to 'hl' instead of 'current-hl'
2024-06-02 18:09:41 +09:00
Junegunn Choi
e2f93e5a2d
--tmux vs. --height: Last one wins 2024-06-01 22:11:15 +09:00
Junegunn Choi
e042143e3f
Immediately close standard output of the child process
Fix #3828
2024-06-01 15:22:05 +09:00
Junegunn Choi
7c613d0d9b
Do not disable --height on mintty (because it works) 2024-06-01 14:45:54 +09:00
Junegunn Choi
b00d46bc14
Fix --height on Windows 2024-06-01 14:36:41 +09:00
Junegunn Choi
555b0d235b
Ignore --height option if it's not supported on the platform
This is to make shell integration work out of the box on Git bash.

  eval "$(fzf --bash)"
  vim <CTRL-T>
    # would print '--height option is currently not supported on this platform'
2024-06-01 14:35:45 +09:00
Junegunn Choi
41bcbe342f
Revert "An '--expect' key should execute actions bound to the key"
To be backward compatible.

Close #3829
2024-06-01 13:21:59 +09:00
Junegunn Choi
7aa88aa115
Fix error message on invalid --tmux option
fzf --tmux foobar
  # not a valid integer: foobar
  # ->
  # invalid tmux option: foobar (expected: [center|top|bottom|left|right][,SIZE[%]][,SIZE[%]])
2024-05-31 16:57:35 +09:00
Junegunn Choi
49b496269c
Fix index out of bounds error on scroll-down action 2024-05-31 16:57:35 +09:00
Junegunn Choi
12630b124d
Make --tmux argument optional 2024-05-29 02:16:18 +09:00
Junegunn Choi
1d59ac09d2
Pass-through error message from 'tmux display-popup'
fzf --tmux 9999
    # height too large
2024-05-29 02:07:56 +09:00
Junegunn Choi
782de139c8
[vim] Native --tmux fix for Neovim 2024-05-28 19:27:31 +09:00
Junegunn Choi
2f51eb2b41
Different marker for the first and last line of multi-line entries
Can be configured via `--marker-multi-line`
2024-05-27 01:35:05 +09:00
Junegunn Choi
0ccbd79e10
Fix --help output: marker default
Co-authored-by: LangLangBart <92653266+LangLangBart@users.noreply.github.com>
2024-05-26 09:24:30 +09:00
Junegunn Choi
1fef36e4bc
Do not allow tabs in pointer and marker 2024-05-25 16:31:34 +09:00
Junegunn Choi
89375005b5
Fix option validation order 2024-05-25 16:23:13 +09:00
Junegunn Choi
7e9a0fcdbd
Change default --scroll-off to 3 2024-05-24 19:25:50 +09:00
Junegunn Choi
7a97532547
Fix --scroll-off for multi-line mode 2024-05-24 19:23:36 +09:00
Junegunn Choi
996abb2831
Fix incorrect colors for selected-{fg,bg,hl}
When a non-default base color scheme is specified, fzf would choose incorrect
colors for selected-*.

  fzf --color 'light,fg:238,bg:255,bg+:253' -m
2024-05-24 00:46:01 +09:00
Junegunn Choi
da500a358f
Use bold bar as the default marker 2024-05-24 00:31:20 +09:00
Junegunn Choi
d9b5c9b2be
Address review comments by @Konfekt
d4216b0dcc
2024-05-23 21:14:08 +09:00
Junegunn Choi
3dee8778d0
execute: Open separate handles to /dev/tty (in, out, err)
# This will no longer cause 'Vim: Warning: Output is not to a terminal'
  fzf --bind 'enter:execute:vim {}' > /tmp/foo
2024-05-23 21:11:12 +09:00
Junegunn Choi
d4216b0dcc
Use MSYS=enable_pcon instead of winpty on mintty 3.4.5 or later 2024-05-23 18:42:54 +09:00
Junegunn Choi
b5b0d6b3ea
Do not run as winpty proxy if winpty is not available 2024-05-23 08:47:38 +09:00
Junegunn Choi
a90426b7ca
Add print(...) action 2024-05-22 22:18:24 +09:00
Junegunn Choi
303c3bae7f
proxy: Pass SIGINT to the child fzf 2024-05-22 22:14:00 +09:00
Junegunn Choi
6b4358f641
An '--expect' key should execute actions bound to the key
Fix #3810
2024-05-22 20:39:09 +09:00
Junegunn Choi
552158f3ad
Ignore SIGINT when running as proxy 2024-05-22 20:01:37 +09:00
Junegunn Choi
0cadf70072
Update the summary 2024-05-21 01:57:22 +09:00
Junegunn Choi
076b3d0a9a
Embed man page in the binary and show it on 'fzf --man' 2024-05-21 01:06:10 +09:00
Junegunn Choi
7b0c9e04d3
Change default marker 2024-05-20 18:51:52 +09:00
Junegunn Choi
573df524fe
Use winpty to launch fzf in Git bash (mintty)
Close #3806

Known limitation:
* --height cannot be used
2024-05-20 18:24:14 +09:00
Junegunn Choi
aee417c46a
Respect $NO_COLOR environment variable
Close #1762
2024-05-20 10:50:00 +09:00
Junegunn Choi
04db44067d
Implement multi-line display of multi-line items 2024-05-20 09:25:30 +09:00
Junegunn Choi
5b204c54f9
Change default pointer and marker character
* Pointer: '▌'
* Marker: '▏'

They will still be set to '>' if `--no-unicode` is given.

Reasons:
* They look okay
* They work better with multi-line items (WIP)
2024-05-19 15:51:32 +09:00
Junegunn Choi
04dfb14e32 Do not 'become' inside a tmux popup
fzf --tmux center --bind 'enter:become:vim {}'
2024-05-18 17:08:36 +09:00
Junegunn Choi
83b6033906 Add --tmux option to replace fzf-tmux script 2024-05-18 17:08:36 +09:00
Zhizhen He
01e7668915
chore: use strings.ReplaceAll (#3801) 2024-05-18 17:06:33 +09:00
Junegunn Choi
8a110e02b9
Fix tcell test case 2024-05-15 00:45:23 +09:00
Junegunn Choi
86d92c17c4
Refactor tui.TtyIn() 2024-05-15 00:28:56 +09:00
Junegunn Choi
c4cc7891b4
Revert "Close handles to /dev/tty", instead reuse handles 2024-05-15 00:15:29 +09:00
Junegunn Choi
218843b9f1
Close handles to /dev/tty 2024-05-14 21:49:47 +09:00
Junegunn Choi
d274d093af
Render UI directly to /dev/tty
See https://github.com/junegunn/fzf/discussions/3792

This allows us to separately capture the standard error from fzf and its
child processes, and there's less chance of user errors of redirecting
the error stream and hiding fzf.
2024-05-14 16:32:26 +09:00
Junegunn Choi
6432f00f0d
0.52.1 2024-05-14 01:54:30 +09:00
LangLangBart
07880ca441
chore: Update flags to include long-form options for case (#3785) 2024-05-09 20:39:21 +09:00
Junegunn Choi
af65aa298a
Add color names: selected-{fg,bg,hl} 2024-05-07 23:38:06 +09:00
Junegunn Choi
0952b2dfd4
Rename --cursor-line to --highlight-line 2024-05-07 19:22:39 +09:00
Junegunn Choi
4bedd33c59
Refactor the code to remove global variables 2024-05-07 16:58:17 +09:00
Junegunn Choi
c5fb0c43f9
Add --cursor-line to highlight the whole current line
Similar to 'set cursorline' of Vim.
2024-05-07 01:34:35 +09:00
Junegunn Choi
9e4780510e
Add current-{fg,bg,hl} as synonyms for {fg,bg,hl}+ 2024-05-07 01:26:25 +09:00
Junegunn Choi
e8405f40fe
Refactor the code so that fzf can be used as a library (#3769) 2024-05-07 01:06:42 +09:00
Junegunn Choi
5669f48343
Do not enable delayed expansion mode when running cmd.exe
And simplify the argument escaping code. Fix #3764.

This may breaks some existing use cases, but the mode causes too much
trouble when escaping arguments and it makes some things not possible.

  # Now you can pass special characters to rg process without any escaping problems: &|<>()@^%!
  fzf --ansi --disabled --bind "change:reload:rg --column --line-number --no-heading --color=always --smart-case -- {q}"

  # No sudden expansion of the arguments on '!'
  fzf --disabled --preview "echo {q} {n} {}" --query "&|<>()@^%!" --prompt "&|<>()@^%!"
2024-05-06 13:46:06 +09:00
Junegunn Choi
24ff66d4a9
Fix change-preview reset by change-preview-window
Fix #3770
2024-05-06 09:40:02 +09:00
Junegunn Choi
bf184449bc
Count $FZF_CLICK_HEADER_LINE from top to bottom
Regardless of `--layout`.

https://github.com/junegunn/fzf/pull/3768#issuecomment-2094806558
2024-05-06 09:27:58 +09:00
Kuremu
7b98c2c653
Add click-header event for reporting clicks within header (#3768)
Sets $FZF_CLICK_HEADER_LINE and $FZF_CLICK_HEADER_COLUMN env vars with
coordinates of the last click inside and relative to the header and
fires click-header event.

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2024-05-05 18:56:43 +09:00
Junegunn Choi
b6add2a257
Fix rendering of preview window border of tcell renderer
(sleep 1; find .) |
    go run -tags tcell main.go --bind 'space:change-preview-window(60%|70%|80%|90%|border-left|border-right|border-vertical|border-top|border-horizontal|border-bottom|border-sharp|border-double|border-block|hidden|left|up|down|right|up|down|)' \
        --preview 'cat {}' --color bg:red,preview-bg:blue \
        --border --margin 3
2024-05-05 17:09:00 +09:00
Junegunn Choi
2bd41f1330
Reduce flicking when changing the size of the preview window with --border
(sleep 1; find .) |
    fzf --bind 'space:change-preview-window(60%|70%|80%|90%|border-left|border-right|border-vertical|border-top|border-horizontal|border-bottom|border-sharp|border-double|border-block|hidden|left|up|down|right|up|down|)' \
        --preview 'cat {}' --color bg:red,preview-bg:blue \
        --border --margin 3
2024-05-05 16:49:30 +09:00
Junegunn Choi
c37cd11ca5
Remove unnecessary flicking when changing the size of the preview window
fzf --bind 'space:change-preview-window(60%|70%|80%|90%|hidden|)' --preview 'cat {}'
2024-05-05 11:10:54 +09:00
Junegunn Choi
9dee8edc0c
Clear characters on 1-column margin after the preview window on the left 2024-05-05 11:06:50 +09:00
Junegunn Choi
f6aa28c380
Fix --info inline-right not properly clearing the previous output
(seq 100000; sleep 1) | fzf --info inline-right --bind load:change-query:x
2024-05-03 12:18:34 +09:00
Junegunn Choi
194a763c46
Escaping for cmd.exe: always use double quotes 2024-04-28 23:30:44 +09:00
Junegunn Choi
8d74446bef
Fix escaping for cmd.exe
Close #3651
Close #2609
2024-04-28 22:03:00 +09:00
Junegunn Choi
7ed6c7905c
Determine shell type once by the basename 2024-04-28 20:11:05 +09:00
Junegunn Choi
159a37fa37
Restore CmdLine parameter when running commands using cmd.exe 2024-04-28 16:01:19 +09:00
Junegunn Choi
2665580120
Add $FZF_POS environment variable
Close #2175
Close #3753
2024-04-27 18:57:22 +09:00
Junegunn Choi
a4391aeedd
Add --with-shell for shelling out with different command and flags (#3746)
Close #3732
2024-04-27 18:36:37 +09:00
Junegunn Choi
608232568b
Add 'change-multi' action
Close #3754
2024-04-27 17:38:06 +09:00
Junegunn Choi
fddbfe7b0e
Fix 'reload' not terminating closed standard input stream
Fix #3750
2024-04-25 16:49:06 +09:00
Junegunn Choi
4ab7fdc28e
Merge identical case clauses 2024-04-25 16:34:05 +09:00
Cheng
d18d92f925
Replace fmt.Errorf with no parameters with errors.New (#3747) 2024-04-22 09:35:33 +09:00
Junegunn Choi
d8bfb6712d
Remove invalid 'result' event when using --sync option
When the search for the initial query doesn't finish immediately
fzf would trigger an invalid 'result' event for an empty query.

  seq 100 | fzf --query 99 --bind result:accept --sync
    # Prints 99

  seq 1000000 | fzf --query 99 --bind result:accept --sync
    # Should print 99, but fzf would print 1
2024-04-20 14:42:43 +09:00
hidewrong
938f23e429
Fix typo in comment (#3734)
Signed-off-by: hidewrong <hidewrong@outlook.com>
2024-04-17 17:13:35 +09:00
Junegunn Choi
3acb4ca90e
Fix streaming filter mode by not running reader callback concurrently
Close #3728
2024-04-14 23:34:25 +09:00
Junegunn Choi
e86b81bbf5
Improve search performance by limiting the search scope
Find the last occurrence of the last character in the pattern and
perform the search algorithm only up to that point.

The effectiveness of this mechanism depends a lot on the shape of the
input and the pattern.
2024-04-14 11:48:44 +09:00
Junegunn Choi
a5447b8b75
Improve search performance by pre-calculating bonus matrix
This gives yet another 5% boost.
2024-04-14 11:47:06 +09:00
Junegunn Choi
7ce6452d83
Improve search performance by pre-calculating character classes
This simple optmization can give more than 15% performance boost
in some scenarios.
2024-04-14 11:47:05 +09:00
Charlie Vieth
3c877c504b
Enable profiling options when 'pprof' tag is set (#2813)
This commit enables cpu, mem, block, and mutex profling of the FZF
executable. To support flushing the profiles at program exit it adds
util.AtExit to register "at exit" functions and mandates that util.Exit
is used instead of os.Exit to stop the program.

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2024-04-13 14:58:11 +09:00
Junegunn Choi
892d1acccb
Fix tcell build 2024-04-13 14:47:04 +09:00
Junegunn Choi
1a9c282f76
Fix unit tests 2024-04-13 14:40:43 +09:00
Junegunn Choi
fd1ba46f77
Export $FZF_KEY environment variable to child processes
It's the name of the last key pressed.

Related #3412
2024-04-13 14:00:16 +09:00
Junegunn Choi
a4745626dd
Add jump and jump-cancel events
Close #3412

    # Default behavior
    fzf --bind space:jump

    # Same as jump-accept action
    fzf --bind space:jump,jump:accept

    # Accept on jump, abort on cancel
    fzf --bind space:jump,jump:accept,jump-cancel:abort

    # Change header on jump-cancel
    fzf --bind 'space:change-header(Type jump label)+jump,jump-cancel:change-header:Jump cancelled'
2024-04-10 20:17:12 +09:00
Junegunn Choi
4cd37fc02b
Disable line wrapping during rendering
Prevent unwanted line wraps that break the layout when the actual
display width of a character is different than expected.
2024-04-09 00:26:25 +09:00
Junegunn Choi
68a35e4735
Do not trim CR on Windows when --read0 is set 2024-04-04 23:39:29 +09:00
Junegunn Choi
8a2df79711
Do not hide separator by default on --info=inline-right|hidden 2024-04-04 00:05:55 +09:00
Junegunn Choi
c30e486b64
Further performance improvements by removing unnecessary copies 2024-04-02 08:43:08 +09:00