Skip to content
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

using isCursorInitialized for domrenderer #4798

Merged
merged 8 commits into from
Sep 14, 2023

Conversation

tisilent
Copy link
Contributor

fix #4790

@tisilent
Copy link
Contributor Author

Testing failed in Linux... 😒

@Tyriar
Copy link
Member

Tyriar commented Sep 13, 2023

It would be initialized because for each test Terminal.reset() is called:

await ctx.value.proxy.reset();

This does not reset the cursor initialization state:

public reset(): void {
/**
* Since _setup handles a full terminal creation, we have to carry forward
* a few things that should not reset.
*/
this.options.rows = this.rows;
this.options.cols = this.cols;
const customKeyEventHandler = this._customKeyEventHandler;
this._setup();
super.reset();
this._selectionService?.reset();
this._decorationService.reset();
this.viewport?.reset();
// reattach
this._customKeyEventHandler = customKeyEventHandler;
// do a full screen refresh
this.refresh(0, this.rows - 1);
}

Since creating a new terminal can complicate the test side effects, we could solve this by making a new inject function:

export function injectSharedRendererTestsStandalone(ctx: ISharedRendererTestContext): void {
  ...
}

These can then re-create the terminal before each test which is probably just a matter of calling dispose terminal and then openTerminal. Similar to what happens in this test but instead in a new describe/beforeEach:

  test('render when visible after hidden', async () => {
    await openTerminal(ctx);
    await ctx.page.evaluate(`
      if ('term' in window) {
        try {
          window.term.dispose();
        } catch {}
      }
    `);
    await ctx.page.evaluate(`document.querySelector('#terminal-container').style.display='none'`);
    await ctx.page.evaluate(`window.term = new Terminal()`);
    await ctx.page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);
    await ctx.page.evaluate(`document.querySelector('#terminal-container').style.display=''`);
    await pollFor(ctx.page, `window.term._core._renderService.dimensions.css.cell.width > 0`, true);
  });

@tisilent
Copy link
Contributor Author

I see, adjust it.

@tisilent
Copy link
Contributor Author

I still need to modify. This way of opening the page is inefficient.

@Tyriar Tyriar added this to the 5.4.0 milestone Sep 14, 2023
@Tyriar Tyriar self-assigned this Sep 14, 2023
Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM provided it changes after my changes to also run these in canvas/webgl 👍

@Tyriar Tyriar merged commit 1618092 into xtermjs:master Sep 14, 2023
16 of 18 checks passed
@tisilent tisilent deleted the fix-domrenderer-isCursorInitialized branch September 15, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Domrender not using isCursorInitialized
2 participants