Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fzf sixels image preview empty on Windows Terminal Preview + pwsh + chafa on Windows #3995

Open
5 of 11 tasks
ykhan21 opened this issue Sep 12, 2024 · 10 comments
Open
5 of 11 tasks
Labels

Comments

@ykhan21
Copy link

ykhan21 commented Sep 12, 2024

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • 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
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish
  • 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:

  1. Get Windows Terminal Preview here: (https://github.com/microsoft/terminal/releases/tag/v1.22.2362.0).
  2. Run scoop install fzf chafa.
  3. Run ls -name *.png | fzf --preview 'chafa -s 50x50 -f sixels {}' in directory that has png files.
@lunrenyi
Copy link

I also encountered a similar problem, and I was able to reproduce it on Windows Terminal + gitbash:

echo hello | fzf --preview='type ls'

企业微信截图_17213711123827
企业微信截图_17213711396279

  • PS: This problem doesn't occur in the VScode Terminal + gitbash
    企业微信截图_17213713955825

@ykhan21 ykhan21 changed the title fzf image preview empty on Windows Terminal Preview + pwsh + chafa on Windows fzf sixels image preview empty on Windows Terminal Preview + pwsh + chafa on Windows Sep 13, 2024
@ykhan21
Copy link
Author

ykhan21 commented Sep 14, 2024

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.
image
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?

@lunrenyi
Copy link

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. image 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

@ykhan21
Copy link
Author

ykhan21 commented Sep 14, 2024

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. image 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

@junegunn
Copy link
Owner

Does it work in non-fullscreen mode? e.g. --height=-1

@ykhan21
Copy link
Author

ykhan21 commented Sep 15, 2024

Yes, ls -name *.png | fzf --height=-1 --preview 'chafa -s 50x50 -f sixels {}' works.

@ykhan21
Copy link
Author

ykhan21 commented Sep 15, 2024

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%.

  1. Large image:
    image
  2. Going to a smaller image:
    image

@ykhan21
Copy link
Author

ykhan21 commented Sep 15, 2024

Yes, ls -name *.png | fzf --height=-1 --preview 'chafa -s 50x50 -f sixels {}' works.

This works, but clicking to select something is broken.

@stevenwalton
Copy link

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.

@junegunn
Copy link
Owner

junegunn commented Oct 20, 2024

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.

  1. https://github.com/junegunn/fzf/blob/master/src/tui/tcell.go
  2. 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.

559fb7e

We need to find a way to fix #3799

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants