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.
https://github.com/junegunn/fzf/issues/1360#issuecomment-788178140
# Redirect /dev/tty to suppress "Vim: Warning: Input is not from a terminal"
ls | fzf --bind "enter:execute(vim {} < /dev/tty)"
# With this change, we can omit "< /dev/tty" part
ls | fzf --bind "enter:execute(vim {})"
- `--phony` renamed to `--disabled` for consistency
- `--no-phony` is now `--enabled`
- Added `enable-search`, `disable-search`, and `toggle-search` actions
for `--bind`
- Added `--color` options: `query` and `disabled`
Close#2303
Some programs use it to set the background color for the whole line.
fzf --preview "printf 'normal \x1b[42mgreen\x1b[0K \x1b[43myellow\x1b[m\nnormal again'"
fzf --preview 'delta <(echo foo) <(echo bar) < /dev/tty'
Fix#2249