Closed koszeggy closed 1 year ago
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)
I'd rather just add native support to the Terminal for displaying images - either through sixel (https://github.com/microsoft/terminal/issues/448) or a good image protocol (https://github.com/microsoft/terminal/issues/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.
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.
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](https://i.stack.imgur.com/oXH3y.png)
And the aforementioned Far Manager application with the Image Viewer plugin used to work like this:![Image in pre-Windows 11 console window](https://farplugs.sourceforge.io/img/imageview.png)
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.