-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[bug fix] Fix the flickering terminal widget when resizing. #12320
[bug fix] Fix the flickering terminal widget when resizing. #12320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your first contribution 👍
@msujew @vince-fugnitto this looks like a low-hanging fruit for getting our PR count down :-) |
@meng-jpg just so you're aware, it has been difficult to merge the pull-request due to a CI option we have where the branch needs to be constantly rebased to master and not out-of-date. Unfortunately we cannot perform the update ourselves unless you grant committers access to perform edits. |
Sorry, the PR was created from a fork living under an organization (rather than an individual). I cannot find the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 I confirmed that the resizing behavior is much better after the updates.
The only impediment is the "out-of-date" check which I (or other committers) unfortunately cannot update the pull-request for you.
@meng-jpg Sorry, do you mind rebasing again? Someone else merged their PR before we could merge yours. |
protected resizeTerminal(): void { | ||
protected resizeTerminal = debounce(() => this.doResizeTerminal(), 50); | ||
|
||
protected doResizeTerminal(): void { | ||
const geo = this.fitAddon.proposeDimensions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During automated tests, this proposeDimensions
function call yields undefined
for some reason, which makes our tests fail. I'm not sure why, since it really shouldnt. However, we should just guard against it to fix the tests. See also here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we have a race condition. The previous test creates a terminal widget and it's then disposed it in the afterEach()
before the following (failing) test is run. What I think happens is that between the moment the resize is triggered and the debounce
delay has expired, the previous test is finished, and the terminal widget has been disposed.
It's not something likely to happen at the human scale, but since we introduce a delay here, it seems reasonable to make sure that the widget is not disposed before trying to access its internals. e.g.:
protected doResizeTerminal(): void {
if (this.isDisposed) {
return;
}
const geo = this.fitAddon.proposeDimensions();
[...]
@meng-jpg Please see my comment above - i think it will be easily fixed. Let us know if you need help with anything. |
@meng-jpg are you still interested in contributing the pull-request, for the failing test please see #12320 (comment). |
The current state breaks our integration test suite.
I have created #12587 to fix this issue, since the original contributor doesn't answer. |
What it does
Call
debounce
for the methodresizeTerminal
to fix the issue of widget content flickering when the terminal widget is resizing.Issue: #12280
How to test
1.start theia electron
2.open a new terminal
3.resize the window
Review checklist
Reminder for reviewers