microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.26k stars 8.27k forks source link

Content sometimes disappears when moving back to Terminal window #2733

Open wazzamatazz opened 5 years ago

wazzamatazz commented 5 years ago

Environment

Windows build number: 10.0.18362.0
Windows Terminal version (if applicable): 0.4.2382.0

Any other software?

Steps to reproduce

Can't reproduce consistently, but sometimes, when I navigate back to Windows Terminal from another window, the content of the Terminal window completely disappears and the window becomes transparent.

image

I'm using PowerShell Core, and I typically find that the problem occurs after running an npm script. Sometimes, if I hit up and then Enter, the previous command re-runs and the window returns to normal. On other occasions, this seems to have no effect.

zadjii-msft commented 5 years ago

That's certainly curious. What kind of GPU set up do you have?

I don't think that this is a Xaml Islands bug, since other XAML content is being drawn. Only the Terminal pane is gone, which makes me think it's in the DxRenderer / SwapChainPanel stack.

cc @miniksa since he might be able to ask better questions

zadjii-msft commented 5 years ago

Holy crap I just had this happen to me too, on a Surface Laptop. I even had two panes open, and both panes and the separator had disappeared.

I'm now worried that this might have something to do with window messaging and us re-laying out the client content. Hopefully we can use this to get a consistent repro.

encladeus commented 5 years ago

I can confirm that I've seen this issue about three times in the last few days on version 0.4.2382.0. The only other information that I can provide is:

[1] Had about four Command Prompt tabs open. [2] Had one Ubuntu tab open. [3] Was unable to click on any of the tabs, the foreground window was as reported above.

However, after the second time that this occurred, I found a workaround: The + and down-arrow buttons were active, so I opened a new Command Prompt and everything restored itself. That is, the window repainted and all of the other tabs became active and I could navigate as per normal.

wazzamatazz commented 5 years ago

That's certainly curious. What kind of GPU set up do you have?

I don't think that this is a Xaml Islands bug, since other XAML content is being drawn. Only the Terminal pane is gone, which makes me think it's in the DxRenderer / SwapChainPanel stack.

cc @miniksa since he might be able to ask better questions

I'm using an Intel HD 630 GPU (Dell XPS 15 9560). I also have a discrete NVidia GTX 1050, so I will try switching to that and see if I can recreate it.

miniksa commented 5 years ago

If this goes away when the window is:

Then my theory is that one of the pieces of the DirectX pipeline bought the farm and we don't realize it until the next regularly scheduled repaint. We probably need to increase the error handling/detection of some of the DX objects and trigger a full redraw when they go away.

wazzamatazz commented 5 years ago

Just happened again. The minimize/maximize/close buttons are unavailable when it happens - they disappear from the window. However, the new tab button was still active, and everything came back to life when I opened a new tab.

encladeus commented 5 years ago

As @wazzamatazz mentions above about the min/max/close buttons being unavailable (not displayed) when this issue exhibits, that jogged my memory and that is another symptom that I too have experienced.

filip-hejsek commented 5 years ago

I found a reliable way to reproduce this issue - minimize the terminal when a new tab is openning. You can do this by clicking on the + icon and immediately pressing Win+D

dsafa commented 5 years ago

Ran into this too. From initial testing using the above reproduction steps, it only occurs with the non client window so that's a good place to start looking.

dsafa commented 5 years ago

I figured out the issue. The non client window applies a window region to the xaml island to expose the caption area. The region is updated when the window is resized or the tab area size changes. If this is happening while the window is minimized, the small window size causes the region to be calculated as a rectangle that only exposes part of the tab area, hiding everything else.

WindowsTerminal_qEaqScGrhp

Here you can see the shape of the window region. The red area is painted in the host window.

WindowsTerminal_xpm10oZSel

Here is the window region when it messes up. It only shows a small area of the tab bar. Not sure if these images illustrate the issue properly.

The only thing I'm not sure of is how this issue occurs when just switching between windows since that shouldn't cause a size change and the only cause I know for now is from minimizing. Maybe this is a different issue, but it looks the same to me.

filip-hejsek commented 5 years ago

You are right - the issue occurs if the size of the tab area changes while the window is minimized. This also happens when some program changes the tab title.

sleep 3; echo -en "\033]0;x\a"; read -sN 1

Running this script in wsl, minimizing the window, waiting a few seconds and restoring the window causes the content to disappear because the title is changed to "x". Pressing any key then changes the title back which causes the content to reappear.

wazzamatazz commented 5 years ago

You are right - the issue occurs if the size of the tab area changes while the window is minimized. This also happens when some program changes the tab title.

sleep 3; echo -en "\033]0;x\a"; read -sN 1

Running this script in wsl, minimizing the window, waiting a few seconds and restoring the window causes the content to disappear because the title is changed to "x". Pressing any key then changes the title back which causes the content to reappear.

This probably makes sense with what I was seeing as well - I was running into the problem when running npm commands, which change the title at the start and end of the operation.

mh-mazen commented 4 years ago

image

Issue Still Occurring on the latest preview as well