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
'
* change-preview-window restores the initial preview window options,
and overrides the properties that are specified
* However, 'hidden' property is treated differently. It is set to
'false' if the specified properties of the action is non-empty.
* cf. toggle-preview takes the "current" preview window options and
toggles the 'hidden' property.
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