mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-22 10:58:59 +00:00
Fix kitty icat handling
This commit is contained in:
parent
3277e8c89c
commit
d3a9a0615b
@ -23,10 +23,13 @@ if [[ ! $type =~ image/ ]]; then
|
||||
|
||||
${batname} --style="${BAT_STYLE:-numbers}" --color=always --pager=never -- "$file"
|
||||
elif [[ $KITTY_WINDOW_ID ]]; then
|
||||
# 'memory' is the fastest option but if you want the image to be scrollable,
|
||||
# you have to use 'stream'
|
||||
kitty icat --clear --transfer-mode=memory --stdin=no --place="${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0" "$file" | sed \$d
|
||||
echo -en "\e[m"
|
||||
# 1. 'memory' is the fastest option but if you want the image to be scrollable,
|
||||
# you have to use 'stream'.
|
||||
#
|
||||
# 2. The last line of the output is the ANSI reset code without newline.
|
||||
# This confuses fzf and makes it render scroll offset indicator.
|
||||
# So we remove the last line and append the reset code to its previous line.
|
||||
kitty icat --clear --transfer-mode=memory --stdin=no --place="${FZF_PREVIEW_COLUMNS}x$((FZF_PREVIEW_LINES))@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/'
|
||||
elif command -v chafa > /dev/null; then
|
||||
chafa -f sixel -s "${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$file"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user