Progress:
* Sixel image can now be displayed with other text, and is scrollable
* If an image can't be displayed entirely due to the scroll offset, fzf
will render a wireframe to indicate that an image should be displayed
* Renamed $FZF_PREVIEW_{WIDTH,HEIGHT} to $FZF_PREVIEW_PIXEL_{WIDTH,HEIGHT}
for clarity
* Added bin/fzf-preview.sh script to demonstrate how to display an image
using Kitty or Sixel protocol
An example:
ls *.jpg | fzf --preview='seq $((FZF_PREVIEW_LINES*9/10)); fzf-preview.sh {}; seq 100'
A known issue:
* If you reduce the size of the preview window, the image may extend
beyond the preview window
# Scrolling will behave similarly to CTRL-E and CTRL-Y of vim
fzf --bind scroll-up:offset-up,scroll-down:offset-down \
--bind ctrl-y:offset-up,ctrl-e:offset-down \
--scroll-off=5
Close#3456
Close#3228
* Works inside and outside of tmux
* There is a problem where fzf unnecessarily displays the scroll offset
indicator at the topbright of the screen when the image just fits the
preview window. This is because `kitty icat` generates an extra line
after the image area.
# A 5-row images; an extra row at the end confuses fzf
["\e_Ga ... \e[9C̅̅ࠪ̅̍ࠪ̅̎ࠪ̅̐ࠪ̅̒ࠪ̅̽ࠪ̅̾ࠪ̅̿ࠪ̅͆ࠪ̅͊ࠪ̅͋ࠪ\n",
"\r\e[9C̍̅ࠪ̍̍ࠪ̍̎ࠪ̍̐ࠪ̍̒ࠪ̍̽ࠪ̍̾ࠪ̍̿ࠪ̍͆ࠪ̍͊ࠪ̍͋ࠪ\n",
"\r\e[9C̎̅ࠪ̎̍ࠪ̎̎ࠪ̎̐ࠪ̎̒ࠪ̎̽ࠪ̎̾ࠪ̎̿ࠪ̎͆ࠪ̎͊ࠪ̎͋ࠪ\n",
"\r\e[9C̐̅ࠪ̐̍ࠪ̐̎ࠪ̐̐ࠪ̐̒ࠪ̐̽ࠪ̐̾ࠪ̐̿ࠪ̐͆ࠪ̐͊ࠪ̐͋ࠪ\n",
"\r\e[9C̒̅ࠪ̒̍ࠪ̒̎ࠪ̒̐ࠪ̒̒ࠪ̒̽ࠪ̒̾ࠪ̒̿ࠪ̒͆ࠪ̒͊ࠪ̒͋ࠪ\n",
"\r\e[39m\e8"]
* Example:
fzf --preview='
if file --mime-type {} | grep -qF 'image/'; then
# --transfer-mode=memory is the fastest option but if you want fzf to be able
# to redraw the image on terminal resize or on 'change-preview-window',
# you need to use --transfer-mode=stream.
kitty icat --clear --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {}
else
bat --color=always {}
fi
'
Can we find a better name? I have considered the followings.
* 'point', because "the pointer" points to the current item.
* 'shift', 'switch', 'move', etc. These are not technically correct
because the current item can change without cursor movement (--tac,
reload, search update)
* 'change' is already taken. 'change-current' feels a bit wordy and
sounds wrong, 'current-changed' is wordy and doesn't go well with the
other event names
* 'target', not straightforward
Close#3053
* Default border style on Windows is changed to `sharp` because some
Windows terminals are not capable of displaying `rounded` border
characters correctly.
* If your terminal emulator renders each box-drawing character with
2 columns, set `RUNEWIDTH_EASTASIAN` environment variable to `1`.