@electerm/electerm-react 5.1.16 → 5.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -216,8 +216,15 @@ export default class AttachAddonCustom {
216
216
  let str = data
217
217
  if (typeof data !== 'string') {
218
218
  try {
219
+ // Decode in streaming mode: slow SSH servers (e.g. embedded router
220
+ // CLIs) often deliver a multi-byte UTF-8 char (CJK = 3 bytes) split
221
+ // across TCP segments, and the server-side idle fast path may forward
222
+ // the first segment immediately. Without { stream: true } the decoder
223
+ // would turn each partial fragment into U+FFFD instead of carrying the
224
+ // trailing bytes over to the next chunk and reassembling the char.
219
225
  str = this.decoder.decode(
220
- data instanceof ArrayBuffer ? data : new Uint8Array(data)
226
+ data instanceof ArrayBuffer ? data : new Uint8Array(data),
227
+ { stream: true }
221
228
  )
222
229
  } catch (e) {
223
230
  str = ''
@@ -435,6 +442,9 @@ export default class AttachAddonCustom {
435
442
  this._flushScheduled = false
436
443
  this._writeBuffer = []
437
444
  this._bufferBytes = 0
445
+ // Reset the streaming decoder so any partial multi-byte sequence held
446
+ // over from this connection can not leak into a reused instance.
447
+ this.decoder = new TextDecoder('utf-8')
438
448
  this.term = null
439
449
  this._disposables.forEach(d => d.dispose())
440
450
  this._disposables.length = 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "5.1.16",
3
+ "version": "5.1.20",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",