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

fix mouse event listener change before term attached #1905

Merged
merged 2 commits into from
Jan 24, 2019

Conversation

pfitzseb
Copy link
Contributor

@pfitzseb pfitzseb commented Jan 21, 2019

Whenever a terminal would receive a \x1b[?1003h or \x1b[?1003l escape code (e.g. when opening a tmux session) before being attached with terminal.open(element) the following internal error would be thrown:

Uncaught TypeError: Cannot read property 'classList' of undefined
    at InputHandler.resetMode (InputHandler.ts:1482)
    at Array.<anonymous> (InputHandler.ts:161)
    at EscapeSequenceParser.parse (EscapeSequenceParser.ts:507)
    at InputHandler.parse (InputHandler.ts:299)
    at Terminal._innerWrite (Terminal.ts:1382)
    at Terminal.ts:1351

This PR fixes that issue and should still apply the correct classes at all times.

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.

Nice catch, I guess the element will not have the class if open after entering tmux though? Could you also add this in open too?

if (this.mouseEvents) {
  // add class..
}

@pfitzseb
Copy link
Contributor Author

I did. The second branch there should technically be pointless but can't hurt to have I think.

@Tyriar
Copy link
Member

Tyriar commented Jan 24, 2019

@pfitzseb doh how did I miss that 😅

@Tyriar Tyriar added this to the 3.11.0 milestone Jan 24, 2019
@Tyriar Tyriar self-assigned this Jan 24, 2019
@Tyriar Tyriar merged commit 2edf02e into xtermjs:master Jan 24, 2019
@pfitzseb pfitzseb deleted the sp/mousehandler branch March 27, 2019 09:55
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.

2 participants