fix decoding race condition with new terminal sessions (#1366)

This commit is contained in:
Guillermo Rauch 2017-01-09 10:05:44 -08:00 committed by Matheus Fernandes
parent 2b56ab27ad
commit 74df6920e9

View file

@ -150,6 +150,19 @@ export default class Term extends Component {
}
write(data) {
// sometimes the preference set above for
// `receive-encoding` is not known by the vt
// before we type to write (since the preference
// manager is asynchronous), so we force it to
// avoid buffering
// this fixes a race condition where sometimes
// opening new sessions results in broken
// output due to the term attempting to decode
// as `utf-8` instead of `raw`
if (this.term.vt.characterEncoding !== 'raw') {
this.term.vt.characterEncoding = 'raw';
}
this.term.io.writeUTF8(data);
}