wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.69k stars 746 forks source link

wezterm imgcat with vifm #2902

Open Grueslayer opened 1 year ago

Grueslayer commented 1 year ago

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

20221122-154621-68c754b1

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

wezterm and vifm using imgcat don't work quite well together, some behaviour maybe is Windows specific other maybe a global issue.

adding this to vifmrc will add a preview (when using :view in vifm) for picture files

  fileviewer {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm},<image/*>
         \ wezterm imgcat --width %pw --height %ph %c:p %pd

for windows maybe using escaped filepath is better

  fileviewer {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm},<image/*>
         \ wezterm imgcat --width %pw --height %ph %"c:p %pd

On MacOS it will correctly displays the image but the file list pane will get corrupted. Maybe that can be fixed by not changing the cursor?

So we need to add an option to wezterm imgcat. By the way, it would be nice to have the upper left position X/Y also as new parameters like imgcat support.

On Windows it looks quite different: No image (or any other thing) is been displayed, the area keeps empty. Calling wezterm imgcat with the same parameters diplays it the right way.

So I can only assume

a) it is been displayed outside the area (because vifm has a different cursor position on windows, so having x/y as parameter like described above may help) b) vifm has a different / alternative screen area than wezterm uses

Would be fine to fix both things (maybe we need the help from vifm maintainer).

I can help to setup vifm for testing purposes on your system.

To Reproduce

No response

Configuration

no config

Expected Behavior

No response

Logs

No response

Anything else?

No response

wez commented 1 year ago

There's not a lot for me to go on here. Can you reduce things to concrete steps and concrete descriptions?

I can't install and replicate every possible environment as I simply don't have the time or resources to do that; I'm not going to learn what vifm is or install it on multiple operating systems.

It can sometimes be helpful to include a session recording for a specific scenario; here's my canned response for that:


*** Finished recording to /var/tmp/wezterm-recording-sF6B3u.cast.txt

The file is an asciicast (compatible with https://asciinema.org/) and can also be replayed using wezterm replay.

The terminal recording allows me to replicate what is being sent to the terminal without requiring me to install the same applications as you and replicate your configuration for everything.


Regarding Windows: ConPTY can swallow or re-order escape sequences that it doesn't understand in a number of situations. Relevant upstream issues are:

A way to determine if an issue is ConPTY specific is to use wezterm ssh to connect to a unix system (either linux or macos) and run the same software: if that works fine then the issue is most likely due to ConPTY.

Grueslayer commented 1 year ago

I tried to strip it down and create a simple example as possible (but I think you should have a look at vifm as it is the best file manager imho)

The following lines will

  1. create a new directory
  2. loading two of your images as new files into this directory
  3. downloading vifm.exe (it is a simple exe without any further files or installation needed)
  4. starting local vifm, skipping any configuration file, setting the second pane as preview and selecting two.png (which should than be displayed in the right pane but isn't)
mkdir weztermvifmtest
cd weztermvifmtest

curl https://wezfurlong.org/images/wez-flame-hair.jpg -o wez-flame-hair.jpg
curl https://wezfurlong.org/wezterm/screenshots/two.png -o two.png

curl https://builds.vifm.info/builds/vifm-w64-se-v0.12.1-120-g919cdec6aebf.exe -o vifm.exe

.\vifm.exe --no-configs -c view --select two.png -c "fileviewer {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm},<image/*> wezterm imgcat --width %pw --height %ph %\"c:p %pd"

Furthermore I made a record session which these files and moving the cursor two files down to have the second image selected, which is also not been displayed.

wezterm-recording-dPTLvp.cast.txt