mirror of
https://github.com/junegunn/fzf.git
synced 2024-08-16 18:00:33 +03:00
Kitty image support improvements
* Use `--unicode-placeholder` for consistent result in and out of tmux * Use updated version of junegunn/go-runewidth that handles diacritics used in Kitty Unicode placeholder Close #3567
This commit is contained in:
parent
cdfaf761df
commit
e7718b92b7
@ -124,7 +124,7 @@ CHANGELOG
|
||||
# --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 {} | sed \$d
|
||||
kitty icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {} | sed \$d
|
||||
else
|
||||
bat --color=always {}
|
||||
fi
|
||||
|
@ -741,7 +741,7 @@ Kitty, you can make fzf display an image in the preview window.
|
||||
```sh
|
||||
fzf --preview='
|
||||
if file --mime-type {} | grep -qF image/; then
|
||||
kitty icat --clear --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {} | sed \$d
|
||||
kitty icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {} | sed \$d
|
||||
else
|
||||
bat --color=always {}
|
||||
fi
|
||||
|
@ -53,7 +53,7 @@ if [[ $KITTY_WINDOW_ID ]]; then
|
||||
# 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="$dim@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/'
|
||||
kitty icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place="$dim@0x0" "$file" | sed '$d' | sed $'$s/$/\e[m/'
|
||||
|
||||
# 2. Use chafa with Sixel output
|
||||
elif command -v chafa > /dev/null; then
|
||||
|
2
go.mod
2
go.mod
@ -2,7 +2,7 @@ module github.com/junegunn/fzf
|
||||
|
||||
require (
|
||||
github.com/gdamore/tcell/v2 v2.5.4
|
||||
github.com/junegunn/go-runewidth v0.0.0-20240114080738-1b95d8d53ad8
|
||||
github.com/junegunn/go-runewidth v0.0.15-0.20240116150947-31c2dd15ab48
|
||||
github.com/mattn/go-isatty v0.0.17
|
||||
github.com/mattn/go-shellwords v1.0.12
|
||||
github.com/rivo/uniseg v0.4.4
|
||||
|
4
go.sum
4
go.sum
@ -2,8 +2,8 @@ github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdk
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell/v2 v2.5.4 h1:TGU4tSjD3sCL788vFNeJnTdzpNKIw1H5dgLnJRQVv/k=
|
||||
github.com/gdamore/tcell/v2 v2.5.4/go.mod h1:dZgRy5v4iMobMEcWNYBtREnDZAT9DYmfqIkrgEMxLyw=
|
||||
github.com/junegunn/go-runewidth v0.0.0-20240114080738-1b95d8d53ad8 h1:qcSgFcU7GG0oYYbUzJJvv2AcJRPzjVZLwrL4ZahMpOw=
|
||||
github.com/junegunn/go-runewidth v0.0.0-20240114080738-1b95d8d53ad8/go.mod h1:Mq6NazeZhIIQPMFoInCi35AktcN/MuW2elHsDK5N52w=
|
||||
github.com/junegunn/go-runewidth v0.0.15-0.20240116150947-31c2dd15ab48 h1:546WmTZE4BUDJXhKlsaqhgdAPt+yWp82cNkzJxsvVDQ=
|
||||
github.com/junegunn/go-runewidth v0.0.15-0.20240116150947-31c2dd15ab48/go.mod h1:Mq6NazeZhIIQPMFoInCi35AktcN/MuW2elHsDK5N52w=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
|
||||
|
Loading…
Reference in New Issue
Block a user