🐛 Fix a regression from the previous commit and a comment

This commit is contained in:
Matheus Fernandes 2017-01-14 18:12:08 -02:00
parent e5c076e82f
commit f8d5dcd060
No known key found for this signature in database
GPG key ID: DD07CA4EA7B65C4F

View file

@ -394,10 +394,14 @@ hterm.Screen.prototype.syncSelectionCaret = function () {
s.addRange(r);
};
const oldScrollPortFocus = hterm.ScrollPort.prototype.focus;
// For some reason, when the original version of this function was called right
// after a new tab was created, it was breaking the focus of the other tab.
// After some investigation, I (matheuss) found that `this.iframe_.focus();` (from
// the original function) was causing the issue. So right now we're overriding
// the function to prevent the `iframe_` from being focused.
// This shouldn't create any side effects we're _stealing_ the focus from `htem` anyways.
hterm.ScrollPort.prototype.focus = function () {
oldScrollPortFocus();
this.terminal.focusHyperCaret();
this.screen_.focus();
};
// fixes a bug in hterm, where the cursor goes back to `BLOCK`