bellecp / fast-p

MIT License
338 stars 26 forks source link

PDF preview in both preview window and the search window #28

Closed jojowakaki closed 2 weeks ago

jojowakaki commented 1 month ago

While using the p() function to search for pdf, the search window displays only one result at a time and displays the whole document instead of appearing as one liner.

fzf version: 0.53.0 (c4a9ccd6) fast-p version: 0.2.5

code used in .bashrc

p () {
    open=xdg-open   # this will open pdf file withthe default PDF viewer on KDE, xfce, LXDE and perhaps on other desktops.

    ag -U -g ".pdf$" \
    | fast-p \
    | fzf --read0 --reverse -e -d $'\t'  \
        --preview-window down:80% --preview '
            v=$(echo {q} | tr " " "|"); 
            echo -e {1}"\n"{2} | grep -E "^|$v" -i --color=always;
        ' \
    | cut -z -f 1 -d $'\t' | tr -d '\n' | xargs -r --null $open > /dev/null 2> /dev/null
}

Screenshot-2024-06-11_17 25 52

Using the old historical bash code as seen here, correct behaviour is still retained. List of files is presented as one line for each possible file.

Screenshot-2024-06-11_17 22 02

bellecp commented 2 weeks ago

This appears to be a new feature of fzf to support multi-line items in the results. Could you try with the extra option

--no-multi-line

https://junegunn.github.io/fzf/reference/#--no-multi-line

jojowakaki commented 2 weeks ago

It works as intended with --no-multi-line