fzf sixels image preview empty on Windows Terminal Preview + pwsh + chafa on Windows
Checklist
- [X] I have read through the manual page (
man fzf) - [X] I have searched through the existing issues
- [X] For bug reports, I have checked if the bug is reproducible in the latest version of fzf
Output of fzf --version
0.55.0 (fc69308)
OS
- [ ] Linux
- [ ] macOS
- [X] Windows
- [ ] Etc.
Shell
- [ ] bash
- [ ] zsh
- [ ] fish
- [X] pwsh
Problem / Steps to reproduce
Windows Terminal Preview now supports sixels. The stable release of Windows Terminal does not yet support it.
Problem:
In pwsh, on Windows Terminal Preview, when you run ls -name *.png | fzf --preview 'chafa -s 50x50 -f sixels {}', the preview window is empty.
Steps:
- Get Windows Terminal Preview here: (https://github.com/microsoft/terminal/releases/tag/v1.22.2362.0).
- Run
scoop install fzf chafa. - Run
ls -name *.png | fzf --preview 'chafa -s 50x50 -f sixels {}'in directory that has png files.
I also encountered a similar problem, and I was able to reproduce it on Windows Terminal + gitbash:
echo hello | fzf --preview='type ls'
- PS: This problem doesn't occur in the VScode Terminal + gitbash
This is issue related to sixels image previews on Windows. Your issue seems to be related to text previews.
Also, I cannot reproduce your issue. See the image below.
This is on Git Bash + Windows Terminal.
What version is your git, fzf, and Windows Terminal? And what font do you use in Windows Terminal?
This is issue related to sixels image previews on Windows. Your issue seems to be related to text previews.
Also, I cannot reproduce your issue. See the image below.
This is on Git Bash + Windows Terminal.
What version is your git, fzf, and Windows Terminal? And what font do you use in Windows Terminal?
- Window version: windows 11 家庭中文版 23H2 22631.4037
- Git version: 2.42.0.windows.2
- Windows Terminal version: 1.20.11781.0
- fzf version: 0.55.0
- Font: Cascadia Mono
This is issue related to sixels image previews on Windows. Your issue seems to be related to text previews. Also, I cannot reproduce your issue. See the image below.
This is on Git Bash + Windows Terminal. What version is your git, fzf, and Windows Terminal? And what font do you use in Windows Terminal?
- Window version: windows 11 家庭中文版 23H2 22631.4037
- Git version: 2.42.0.windows.2
- Windows Terminal version: 1.20.11781.0
- fzf version: 0.55.0
- Font: Cascadia Mono
I can't reproduce it with Cascadia Mono. The preview works for me.
- Git: git version 2.46.0.windows.1
- fzf: 0.55.0 (fc69308)
- Windows Terminal: 1.21.240823001
Does it work in non-fullscreen mode? e.g. --height=-1
Yes, ls -name *.png | fzf --height=-1 --preview 'chafa -s 50x50 -f sixels {}' works.
Also, if the image is too large and it is displayed, some residue is left from the large image when you go to a smaller image. Here, I have --height=40%.
- Large image:
- Going to a smaller image:
Yes,
ls -name *.png | fzf --height=-1 --preview 'chafa -s 50x50 -f sixels {}'works.
This works, but clicking to select something is broken.
I just saw this issue and I have 2 relevant issues open in the chafa project. See Chafa-#217 and Chafa-#218. Also a issue in wezterm which I think is more related to #3646 and #3486 but I suspect there are underlying issues connecting all of these. There's additional complexity introduced when using ssh and tmux fwiw.
I believe there are overlapping issues with fzf and chafa. Why I came here in the first place was actually to ask about $FZF_PREVIEW_COLUMNS and $FZF_PREVIEW_LINES since these do not appear to be calculated in a way that is compatible with chafa's (though if you read the issue there's some confusion there too).
I'll keep working with the chafa team but it may be good to at least have these cross linked and note that this issue appears to be cross platform.
It's a long story.
We currently have two different renderer implementations for Windows, one is based on tcell library which is used when opening fzf in full-screen mode. The other is "light renderer" which was added later to support --height option on Windows.
- https://github.com/junegunn/fzf/blob/master/src/tui/tcell.go
- https://github.com/junegunn/fzf/blob/master/src/tui/light_windows.go
"Light" renderer has image support (using simple/naive pass-through mechanism), but tcell renderer does not, so that's why image is only shown when --height is given.
I tried removing the tcell renderer and using the light renderer even in full-screen mode, but it turned out to have an issue with non-ASCII characters, so I had to revert the decision.
https://github.com/junegunn/fzf/commit/559fb7ee4552312f59a4bbe428199db9f5aa1247
We need to find a way to fix https://github.com/junegunn/fzf/issues/3799
This is on Git Bash + Windows Terminal.