numux 2.0.2 → 2.0.3

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.
Files changed (2) hide show
  1. package/dist/numux.js +18 -5
  2. package/package.json +1 -1
package/dist/numux.js CHANGED
@@ -36,7 +36,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
36
36
  var require_package = __commonJS((exports, module) => {
37
37
  module.exports = {
38
38
  name: "numux",
39
- version: "2.0.2",
39
+ version: "2.0.3",
40
40
  description: "Terminal multiplexer with dependency orchestration",
41
41
  type: "module",
42
42
  license: "MIT",
@@ -3265,10 +3265,18 @@ class PrefixDisplay {
3265
3265
  const decoder = this.decoders.get(name) ?? new TextDecoder;
3266
3266
  const text = decoder.decode(data, { stream: true });
3267
3267
  const buffer = (this.buffers.get(name) ?? "") + text;
3268
- const lines = buffer.split(/\r\n|\n|\r/);
3269
- this.buffers.set(name, lines.pop() ?? "");
3268
+ const lines = buffer.split(/\r*\n/);
3269
+ let tail = lines.pop() ?? "";
3270
+ if (tail.includes("\r")) {
3271
+ const trailingCrs = tail.match(/\r+$/)?.[0] ?? "";
3272
+ const base = tail.slice(0, tail.length - trailingCrs.length);
3273
+ const lastCr = base.lastIndexOf("\r");
3274
+ tail = (lastCr === -1 ? base : base.slice(lastCr + 1)) + trailingCrs;
3275
+ }
3276
+ this.buffers.set(name, tail);
3270
3277
  for (const line of lines) {
3271
- this.printLine(name, line);
3278
+ const lastCr = line.lastIndexOf("\r");
3279
+ this.printLine(name, lastCr === -1 ? line : line.slice(lastCr + 1));
3272
3280
  }
3273
3281
  }
3274
3282
  handleStatus(_name, _status) {}
@@ -3294,7 +3302,12 @@ class PrefixDisplay {
3294
3302
  flushBuffer(name) {
3295
3303
  const remaining = this.buffers.get(name) ?? "";
3296
3304
  if (remaining.length > 0) {
3297
- this.printLine(name, remaining);
3305
+ const stripped = remaining.replace(/\r+$/, "");
3306
+ const lastCr = stripped.lastIndexOf("\r");
3307
+ const visible = lastCr === -1 ? stripped : stripped.slice(lastCr + 1);
3308
+ if (visible.length > 0) {
3309
+ this.printLine(name, visible);
3310
+ }
3298
3311
  this.buffers.set(name, "");
3299
3312
  }
3300
3313
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numux",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Terminal multiplexer with dependency orchestration",
5
5
  "type": "module",
6
6
  "license": "MIT",