Even when {q} is empty. Because, why not?
While this can be seen as a breaking change, there is an easy workaround
to keep the old behavior.
# This will show // even when the query is empty
: | fzf --preview 'echo /{q}/'
# But if you don't want it,
: | fzf --preview '[ -n {q} ] || exit; echo /{q}/'
Close#2759
# Put the cursor on the 10th item
seq 100 | fzf --sync --bind 'start:pos(10)'
# Put the cursor on the 10th to last item
seq 100 | fzf --sync --bind 'start:pos(-10)'
Close#3069Close#395
This reverts commit 750b2a6313.
This can cause a deadlock if the endpoints are accessed in the core event
loop via execute action.
fzf --listen 6266 --bind 'space:execute:curl localhost:6266'
Technically, there's no reason to use the API because the information is
already available via `{}` and `{q}`, but I'd like to completely remove
the risk of misuse.
Fix#2683
This commit fixes the cases where fzf incorrectly determines the
scrollability of the preview window when `--preview-window-wrap` is set.
Wrapping of the preview content happens during the rendering phase, so
it's currently not possible to know how many lines are actually needed
to display the content beforehand. So `preview-bottom` still may not
move to the very bottom with wrapping enabled.
So you can "rotate" through the different options with a single binding.
fzf --preview 'cat {}' \
--bind 'ctrl-/:change-preview-window(70%|down,40%,border-horizontal|hidden|)'
Close#2376
The new actions are named with 'change-' prefix to differentiate from
the pre-existing, one-off 'preview(...)' action.
Fix#2360Fix#2505Fix#2666
Related #2435
Related #2376
- Can set up multiple bindings with different change-preview-window actions
- Not possible to "rotate" through the options with a single binding
- Enlarge or shrink not possible
* [tests] Test fzf's placeholders and escaping on practical commands
This tests some reasonable commands in fzf's templates (for commands,
previews, rebinds etc.), how are those commands escaped (backslashes,
double quotes), and documents if the output is executable in cmd.exe.
Both on Unix and Windows.
* [tests] Add testing of placeholder parsing and matching
Adds tests and bit of docs for the curly brackets placeholders in fzf's
template strings. Also tests the "placeholder" regex.
* [tests] Add more test cases of replacing placeholders focused on flags
Replacing placeholders in templates is already tested, this adds tests
that focus more on the parameters of placeholders - e.g. flags, token
ranges.
There is at least one test for each flag, not all combinations are
tested though.
* [refactoring] Split OS-specific function quoteEntry() to corresponding source file
This is minor refactoring, and also the function's test was made
crossplatform.
* [refactoring] Simplify replacePlaceholder function
Should be equivalent to the original, but has simpler structure.