Print Dialog Shown Off Screen #14559

Closed
opened 2026-01-31 04:13:35 +00:00 by claunia · 6 comments
Owner

Originally created by @juvtib on GitHub (Jul 17, 2021).

Windows Terminal version (or Windows build number)

Windows Terminal Version: 1.9.1942.0

Other Software

vim 8.2 outside WSL

Steps to reproduce

  1. Install Windows Terminal 1.9 and Vim 8.2 on a new Windows 10 box.
  2. Execute "C:\Program Files (x86)\Vim\vim82\vim.exe"
  3. Print via :hardcopy

Expected Behavior

I expect the print dialog to be centered on the screen or on the shell like console host.

Actual Behavior

The print dialog is positioned past the top-left of the screen.

To bring the dialog into view:

  1. Click to focus on the dialog.
  2. Press Alt + Space
  3. Press m
  4. Press Up Arrow to attach the dialog to the mouse cursor.
  5. Move the mouse cursor to drag the dialog into view.
Originally created by @juvtib on GitHub (Jul 17, 2021). ### Windows Terminal version (or Windows build number) Windows Terminal Version: 1.9.1942.0 ### Other Software vim 8.2 outside WSL ### Steps to reproduce 1. Install Windows Terminal 1.9 and Vim 8.2 on a new Windows 10 box. 1. Execute `"C:\Program Files (x86)\Vim\vim82\vim.exe"` 2. Print via `:hardcopy` ### Expected Behavior I expect the print dialog to be centered on the screen or on the shell like console host. ### Actual Behavior The print dialog is positioned past the top-left of the screen. To bring the dialog into view: 1. Click to focus on the dialog. 2. Press Alt + Space 3. Press m 4. Press Up Arrow to attach the dialog to the mouse cursor. 5. Move the mouse cursor to drag the dialog into view.
claunia added the Resolution-ExternalNeeds-Tag-Fix labels 2026-01-31 04:13:35 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jul 19, 2021):

I'm gonna guess that this is /dup #2988. This just has all the same hallmarks of that bug.

@zadjii-msft commented on GitHub (Jul 19, 2021): I'm gonna guess that this is /dup #2988. This just has all the same hallmarks of that bug.
Author
Owner

@ghost commented on GitHub (Jul 19, 2021):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jul 19, 2021): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@juvtib commented on GitHub (Jul 20, 2021):

I don't think this is a duplicate. I'm talking about x,y not z. When I type start . I don't have the same problem as reported in 2988. My issue reproduces today.

@juvtib commented on GitHub (Jul 20, 2021): I don't think this is a duplicate. I'm talking about x,y not z. When I type `start .` I don't have the same problem as reported in 2988. My issue reproduces today.
Author
Owner

@zadjii-msft commented on GitHub (Jul 20, 2021):

Okay yea, I see how that was confusing. Lemme try to explain better:

I'm guessing the root cause of your issue here is that vim can't reliably find the HWND of the Terminal. It probably wants to display the print dialog relative to the window that it's running in. I'm guessing that they use GetConsoleWindow for that value. However, when running in the Terminal, that value is a garbage value. So instead of it opening near the Terminal, it just defaults to (some location).

The start . repro for #2988 is intermittent, but shares the same root cause.

@zadjii-msft commented on GitHub (Jul 20, 2021): Okay yea, I see how that was confusing. Lemme try to explain better: I'm guessing the root cause of your issue here is that `vim` can't reliably find the HWND of the Terminal. It probably wants to display the print dialog relative to the window that it's running in. I'm guessing that they use `GetConsoleWindow` for that value. However, when running in the Terminal, that value is a garbage value. So instead of it opening near the Terminal, it just defaults to (some location). The `start .` repro for #2988 is intermittent, but shares the same root cause.
Author
Owner

@zadjii-msft commented on GitHub (May 18, 2022):

Okay, even after investigating down all the other leads in #2988, :hardcopy is still busted. I'm quite confident that vim.exe is getting the actual position of the console window here to try and center the print dialog on top of it. Problem is, GetConsoleWindow in any ConPTY session (read: terminal) is going to have a 0x0 sized window as the result of that API.

This is gonna require some changes on the part of vim.exe. They'll need to do some combo of

  • maybe use GetAncestor() to try and find the Terminal's HWND as a ROOTOWNER of the console HWND
  • Before 1.14, detect that the HWND that's returned is totally transparent (WS_TRANSPARENT), or 0x0 and then just display the print dialog in the center of the screen

So this is no longer a duplicate issue, it's actually something we can't solve. Sorry!

@zadjii-msft commented on GitHub (May 18, 2022): Okay, even after investigating down all the other leads in #2988, `:hardcopy` is still busted. I'm quite confident that `vim.exe` is getting the actual position of the console window here to try and center the print dialog on top of it. Problem is, `GetConsoleWindow` in any ConPTY session (read: terminal) is going to have a 0x0 sized window as the result of that API. This is gonna require some changes on the part of `vim.exe`. They'll need to do some combo of * maybe use GetAncestor() to try and find the Terminal's HWND as a ROOTOWNER of the console HWND * Before 1.14, detect that the HWND that's returned is totally transparent (WS_TRANSPARENT), or 0x0 and then just display the print dialog in the center of the screen So this is no longer a duplicate issue, it's actually something we can't solve. Sorry!
Author
Owner

@juvtib commented on GitHub (May 19, 2022):

Thanks for checking into this.

@juvtib commented on GitHub (May 19, 2022): Thanks for checking into this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14559