Support ANSI escape sequence for clearing display in preview window

fzf --preview 'for i in $(seq 100000); do
    (( i % 200 == 0 )) && printf "\033[2J"
    echo "$i"
    sleep 0.01
  done'
This commit is contained in:
Junegunn Choi
2020-10-23 21:37:20 +09:00
parent e2b87e0d74
commit a4d9b0b468
4 changed files with 45 additions and 2 deletions

View File

@@ -3,9 +3,27 @@ CHANGELOG
0.24.0
------
- fzf can render preview window before the command completes
- Real-time rendering of preview window
```sh
# fzf can render preview window before the command completes
fzf --preview 'sleep 1; for i in $(seq 100); do echo $i; sleep 0.01; done'
# Preview window can process ANSI escape sequence (CSI 2 J) for clearing the display
fzf --preview 'for i in $(seq 100000); do
(( i % 200 == 0 )) && printf "\033[2J"
echo "$i"
sleep 0.01
done'
```
- To indicate if `--multi` mode is enabled, fzf will print the number of
selected items even when no item is selected
```sh
seq 100 | fzf
# 100/100
seq 100 | fzf --multi
# 100/100 (0)
seq 100 | fzf --multi 5
# 100/100 (0/5)
```
0.23.1