atom-community / terminal

Terminal integrated with atom-community/atom
https://atom.io/packages/atomic-terminal
Other
19 stars 4 forks source link

Terminal does not fully restore on restart if it had been minimized in the dock #30

Open aminya opened 3 years ago

aminya commented 3 years ago

Terminal does not fully restore on restart if it had been minimized in the dock.

See https://github.com/atom-ide-community/terminal/issues/30#issuecomment-711109168

UziTech commented 3 years ago

Can you give more information about how often this happens? what exactly doesn't restore? reproducible conditions?

aminya commented 3 years ago

When I start an Atom session, I expect the terminal to start again if it was open. Similar to how Atom recovers the open text editors.

UziTech commented 3 years ago

Seems to work fine for me. Do you have the Allow relaunching terminals on startup setting checked?

aminya commented 3 years ago

Yes, I do have it checked. This is random though. Sometimes it works! I will try to get some reproduction steps.

aminya commented 3 years ago

This is what I mean. I need to close this and start a new one: image

UziTech commented 3 years ago

are there any errors in the console? Can you inspect the element and see why it is hidden (display: none, height: 0, etc.)?

UziTech commented 3 years ago

It might be something that could be fixed by https://github.com/xtermjs/xterm.js/pull/3089

aminya commented 3 years ago

There are no errors. It just does not show anything. It is like an empty pane (like in #5)

There is no element to choose:

image

UziTech commented 3 years ago

looks like your IntersectionObserver never gets called. Try setting some log statements to log out entries in https://github.com/atom-ide-community/terminal/blob/master/src/element.ts#L64 so next time it happens we can get more information.

I wonder if this is something with the atom-community version of atom?

aminya commented 3 years ago

Sure. I can add the logs. I am using the latest nightly.

aminya commented 3 years ago

I had a terminal open in the bottom dock, I minimized it. Closed Atom, and opened it again. The pane was empty:

image

Not minimizing the terminal before closing fixes the issue: image

UziTech commented 3 years ago

How is entries.length equal to 0? That should not even be possible. Basically that says there was an intersection observed but no intersections.

That doesn't happen for me.

aminya commented 3 years ago

How can I get more information about entries? This seems like an xterm thing. Let me see if I can debug into xterm

UziTech commented 3 years ago

This doesn't have anything to do with xterm. This looks like an issue with your version of electron. or more specifically the version of chromium bundled with electron.

aminya commented 3 years ago

This is what happens when I try to debug inside the IntersectionObserver callback:

image

If I click keep it open: image

UziTech commented 3 years ago

IntersectionObserver is part of the browser (chromium). That is an issue with the browser, nothing we can change.

The only way we could fix it is use some other way to check for visibility using setTimeout and getBoundingClientRect

aminya commented 3 years ago

The issue is not still solved. You mentioned you can hack something using setTimeout. Can you look into that? @UziTech

UziTech commented 3 years ago

I'll take a look at it tomorrow. It will be hard for me to debug though because it doesn't happen to me. I still don't understand how it happens to you. I wonder if you have some package that polyfills IntersectionObserver incorrectly.

UziTech commented 3 years ago

The biggest problem with polling with setTimeout is it is going to be a performance nightmare.

UziTech commented 3 years ago

The basic idea is we will have to poll with setTimeout until the user opens the dock, which could be never.

aminya commented 3 years ago

If that hurts the performance we should do something else.

UziTech commented 3 years ago

I don't think there is anything else to do. I think the best approach is for you to figure out why it doesn't work for you.