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

Erratic behavior of chafa -f iterm image.jpg on Windows #194

Closed
ykhan21 opened this issue Mar 17, 2024 · 5 comments
Closed

Erratic behavior of chafa -f iterm image.jpg on Windows #194

ykhan21 opened this issue Mar 17, 2024 · 5 comments

Comments

@ykhan21
Copy link

ykhan21 commented Mar 17, 2024

Setup:

On Windows:

  1. Install scoop, run scoop bucket add main, run scoop bucket add extras, and finally run scoop install git wezterm chafa.
  2. Use this image.
  3. Set Wezterm's default shell to the bash shell that was installed with scoop install git. To do this, create a ~/.wezterm.lua file with these contents:
local wezterm = require 'wezterm'
local config = {}
config.default_prog = { 'c:/users/USERNAME/scoop/apps/git/current/bin/bash.exe -i -l' }
return config

See https://wezfurlong.org/wezterm/config/files.html for more details.

Problem:

On Wezterm, chafa -f iterm image.jpg sometimes outputs extra space at the end like so:
image

Notice that the shell prompt starts at the bottom right of the image above.

On mintty (the terminal called Git Bash that is installed when you install Git for Windows is mintty), most of the time, chafa -f iterm image.jpg does not display an image and instead results in a large amount of whitespace, almost as if it were displaying an empty image. Very rarely it displays a distorted half of the image. The showimg script found here works correctly to show images in mintty (Git Bash) in the iterm format.

@AnonymouX47
Copy link

Duplicate of #186

@hpjansson
Copy link
Owner

Thanks for filing the issue, @ykhan21. I think @AnonymouX47 is right - the short version is that Chafa is a native Windows app, and the Wezterm binary is a Cygwin app. These are different platforms that don't play well together. We need to add Cygwin builds (or alternatively, other apps should be made native).

@hpjansson
Copy link
Owner

Closing as duplicate. I don't have the bandwidth to do Cygwin builds too at the moment, but if you get it working there, I'd love to hear about it.

@hpjansson hpjansson closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2024
@ykhan21
Copy link
Author

ykhan21 commented Oct 11, 2024

@hpjansson, are there any drawbacks to having the only Windows build of chafa be cygwin, like Wezterm? Can't you then use it in both native and cygwin terminals?

@hpjansson
Copy link
Owner

The biggest drawbacks are:

  • We'd need to distribute the cygwin1.dll runtime in addition to the program and ensure it can be found in the link path. Currently we only have to ship chafa.exe, which you can run from any path. The Cygwin FAQ claims it's infeasible to link statically (outdated? no idea).
  • I build by cross-compiling, so we'd have to find a decent cross-compiling environment (Linux -> Cygwin). I currently use MXE (Linux -> win32), which is more or less perfect for this. Probably just a matter of doing the research.
  • I'd like to distribute chafa.dll plus headers for windows at some point in the future - it'd need to work in MSVC though, so with native runtime. Most of the issues I've had with bigger and more complex win32 projects in the past stemmed from the fact that native and Cygwin libraries don't mix, but still get mixed up easily. I haven't actually seen any demand from Windows developers though, so it isn't that important.

So it's a good question. My opinion on this was forged in battle about 25 years ago, and maybe things have changed, or it doesn't matter that much anymore. Help with research and testing is very welcome!

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

No branches or pull requests

3 participants