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

Displaying image is not working anymore #15398

Closed
koszeggy opened this issue May 22, 2023 · 3 comments
Closed

Displaying image is not working anymore #15398

koszeggy opened this issue May 22, 2023 · 3 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason.

Comments

@koszeggy
Copy link

Windows Terminal version

All versions

Windows build number

Not relevant

Other Software

No response

Steps to reproduce

Remark: I'm not requesting a new feature here. Though displaying images in Windows Console never has been supported officially, it was definitely possible and it was working since Windows XP until up to Windows 10 and even ConEmu emulates this behavior. This issue has been created from my comment originally posted under #5746, which is a new feature request to support displaying images.

To reproduce the issue you can use the code snippet in a .NET Console application from here or execute a Far Manager console application with Image Viewer plugin.

Expected Behavior

The linked example for .NET should produce a result like this:
Image in Windows Console

And the aforementioned Far Manager application with the Image Viewer plugin used to work like this:
Image in pre-Windows 11 console window

Actual Behavior

The new Windows 11 Terminal apparently does not support this anymore, the images are simply not appearing.

I don't know what's missing to make it work again because GetConsoleWindow still returns the console handle as a Win32 HWND and even the Graphics::FromHWND method returns a seemingly valid instance, it's just its VisibleClipBounds is always an empty rectangle.

@koszeggy koszeggy added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 22, 2023
@zadjii-msft
Copy link
Member

This is absolutely not going to work in the Terminal - I'd rather not give a bodgy workaround to make it work. As mentioned, the GetConsoleWindow thing was never really supported, and I really want to discourage folks from trying that.

I'd rather just add native support to the Terminal for displaying images - either through sixel (#448) or a good image protocol (#5746)

@koszeggy
Copy link
Author

I'd rather just add native support to the Terminal for displaying images - either through sixel (#448) or a good image protocol (#5746)

Whereas a well designed image handling protocol is indeed the recommended and cleanest way for the future it will not help the already existing applications that remain broken.

And also the new projects will have to maintain multiple image handling approaches if they want to be compatible both with the original Windows Console on older Windows versions and the new Windows 11 Terminal.

This is absolutely not going to work in the Terminal

I really hope there is still some room for discussion about it. It could be at least considered how big effort would it be to provide support for this undocumented feature. ConEmu solved it somehow too, which is also a multi-tab console emulator, just like the new Terminal. And since Terminal already solved the hardest part (GetConsoleWindow returns different handles for the individual tabs, so for example SetConsoleTitle could be also tricked to change the text on the tabs that originally meant to be the title on the legacy Win32 console window), I think this would be just some small(?) additional step. Well, at least in my imagination, without seeing any code. 😁 Maybe you could consult with the ConEmu guys how they managed to solve it.

I hope it will not be closed immediately and even if you don't have enough time for this you are willing to accept pull requests from someone who has the courage/knowledge to include this feature.

@zadjii-msft
Copy link
Member

Okay so I'm gonna be the bad guy and just say, no, I don't think this is a scenario we intend to ever support with the Windows Terminal. GetConsoleWindow has been an absolute compatibility nightmare for us, and not one that I want to continue spending any effort trying to make work. I'd 1000% rather just spend engineering effort on "make sixel or any other image protocol work", rather than trying to figure out how apps can hack images into the HWND of the Terminal. There's just too many edge cases to worry about with tabs and panes and focus mode and possibly other UI elements and theming and ... you get it.

ConEmu probably has an easier job of this, with each tab in conemu being a separate HWND. For Terminal, that's simply not the case.

I'm VERY excited about the work that's already been done to get console & terminal closer to sixel. I'd really love to just finish that out at this point.

@zadjii-msft zadjii-msft added the Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason. label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-Won't-Fix We're just really obstinate about this. There's probably a good reason.
Projects
None yet
Development

No branches or pull requests

2 participants