@drisp/cli 0.5.13 → 0.5.14

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.
@@ -2440,7 +2440,7 @@ var cachedVersion = null;
2440
2440
  function readVersion() {
2441
2441
  if (cachedVersion !== null) return cachedVersion;
2442
2442
  try {
2443
- const injected = "0.5.13";
2443
+ const injected = "0.5.14";
2444
2444
  if (typeof injected === "string" && injected.length > 0) {
2445
2445
  cachedVersion = injected;
2446
2446
  return cachedVersion;
@@ -11362,40 +11362,33 @@ var CURSOR_OFF = "\x1B[27m";
11362
11362
  function cursorToVisualPosition(value, cursorOffset, width) {
11363
11363
  if (width <= 0) return { line: 0, col: cursorOffset, totalLines: 1 };
11364
11364
  const segments = value.split("\n");
11365
+ const segmentPieces = segments.map((seg) => wrapSegmentPieces(seg, width));
11366
+ const totalLines = segmentPieces.reduce((sum, ps) => sum + ps.length, 0);
11365
11367
  let visualLine = 0;
11366
11368
  let globalOffset = 0;
11367
11369
  for (let s = 0; s < segments.length; s++) {
11368
11370
  const seg = segments[s];
11371
+ const pieces = segmentPieces[s];
11369
11372
  const segEnd = globalOffset + seg.length;
11370
11373
  if (cursorOffset <= segEnd) {
11371
11374
  const posInSeg = cursorOffset - globalOffset;
11372
- const totalLines2 = visualLine + countSegmentVisualLines(segments, s, width);
11373
- if (seg.length === 0) {
11374
- return { line: visualLine, col: 0, totalLines: totalLines2 };
11375
+ for (let p = 0; p < pieces.length; p++) {
11376
+ const piece = pieces[p];
11377
+ const end = piece.start + piece.text.length;
11378
+ if (posInSeg < end || p === pieces.length - 1) {
11379
+ return {
11380
+ line: visualLine + p,
11381
+ col: posInSeg - piece.start,
11382
+ totalLines
11383
+ };
11384
+ }
11375
11385
  }
11376
- const lineInSeg = Math.min(
11377
- Math.floor(posInSeg / width),
11378
- segmentVisualLines(seg.length, width) - 1
11379
- );
11380
- const colInLine = posInSeg - lineInSeg * width;
11381
- return { line: visualLine + lineInSeg, col: colInLine, totalLines: totalLines2 };
11382
11386
  }
11383
- visualLine += segmentVisualLines(seg.length, width);
11387
+ visualLine += pieces.length;
11384
11388
  globalOffset = segEnd + 1;
11385
11389
  }
11386
- const totalLines = wrapText(value, width).length;
11387
11390
  return { line: Math.max(0, totalLines - 1), col: 0, totalLines };
11388
11391
  }
11389
- function segmentVisualLines(segLen, width) {
11390
- return segLen === 0 ? 1 : Math.ceil(segLen / width);
11391
- }
11392
- function countSegmentVisualLines(segments, fromIdx, width) {
11393
- let count = 0;
11394
- for (let i = fromIdx; i < segments.length; i++) {
11395
- count += segmentVisualLines(segments[i].length, width);
11396
- }
11397
- return count;
11398
- }
11399
11392
  function visualPositionToOffset(value, targetLine, targetCol, width) {
11400
11393
  if (width <= 0) return targetCol;
11401
11394
  const segments = value.split("\n");
@@ -11403,14 +11396,12 @@ function visualPositionToOffset(value, targetLine, targetCol, width) {
11403
11396
  let globalOffset = 0;
11404
11397
  for (let s = 0; s < segments.length; s++) {
11405
11398
  const seg = segments[s];
11406
- const numWrappedLines = segmentVisualLines(seg.length, width);
11407
- if (targetLine < visualLine + numWrappedLines) {
11408
- const lineInSeg = targetLine - visualLine;
11409
- const lineStart = lineInSeg * width;
11410
- const lineLen = Math.min(width, seg.length - lineStart);
11411
- return globalOffset + lineStart + Math.min(targetCol, lineLen);
11412
- }
11413
- visualLine += numWrappedLines;
11399
+ const pieces = wrapSegmentPieces(seg, width);
11400
+ if (targetLine < visualLine + pieces.length) {
11401
+ const piece = pieces[targetLine - visualLine];
11402
+ return globalOffset + piece.start + Math.min(targetCol, piece.text.length);
11403
+ }
11404
+ visualLine += pieces.length;
11414
11405
  globalOffset += seg.length + 1;
11415
11406
  }
11416
11407
  return value.length;
@@ -11456,16 +11447,40 @@ function renderInputLines(value, cursorOffset, width, showCursor, placeholder) {
11456
11447
  return fit(line, width);
11457
11448
  });
11458
11449
  }
11450
+ function wrapSegmentPieces(segment, width) {
11451
+ if (segment.length === 0) return [{ text: "", start: 0 }];
11452
+ if (isSimpleAscii(segment)) {
11453
+ const pieces2 = [];
11454
+ for (let i2 = 0; i2 < segment.length; i2 += width) {
11455
+ pieces2.push({ text: segment.slice(i2, i2 + width), start: i2 });
11456
+ }
11457
+ return pieces2;
11458
+ }
11459
+ const pieces = [];
11460
+ let pieceStart = 0;
11461
+ let pieceWidth = 0;
11462
+ let i = 0;
11463
+ while (i < segment.length) {
11464
+ const cp = segment.codePointAt(i);
11465
+ const chLen = cp > 65535 ? 2 : 1;
11466
+ const charWidth = cachedStringWidth(segment.slice(i, i + chLen));
11467
+ if (pieceWidth > 0 && pieceWidth + charWidth > width) {
11468
+ pieces.push({ text: segment.slice(pieceStart, i), start: pieceStart });
11469
+ pieceStart = i;
11470
+ pieceWidth = 0;
11471
+ }
11472
+ pieceWidth += charWidth;
11473
+ i += chLen;
11474
+ }
11475
+ pieces.push({ text: segment.slice(pieceStart), start: pieceStart });
11476
+ return pieces;
11477
+ }
11459
11478
  function wrapText(text, width) {
11460
11479
  if (width <= 0) return [text];
11461
11480
  const lines = [];
11462
11481
  for (const segment of text.split("\n")) {
11463
- if (segment.length === 0) {
11464
- lines.push("");
11465
- continue;
11466
- }
11467
- for (let i = 0; i < segment.length; i += width) {
11468
- lines.push(segment.slice(i, i + width));
11482
+ for (const piece of wrapSegmentPieces(segment, width)) {
11483
+ lines.push(piece.text);
11469
11484
  }
11470
11485
  }
11471
11486
  return lines;
@@ -18187,4 +18202,4 @@ export {
18187
18202
  startUdsServer,
18188
18203
  sendUdsRequest
18189
18204
  };
18190
- //# sourceMappingURL=chunk-BUNMENOT.js.map
18205
+ //# sourceMappingURL=chunk-XZDDQJUX.js.map
package/dist/cli.js CHANGED
@@ -97,7 +97,7 @@ import {
97
97
  writeAttachmentMirror,
98
98
  writeGatewayClientConfig,
99
99
  wsClientOptionsForEndpoint
100
- } from "./chunk-BUNMENOT.js";
100
+ } from "./chunk-XZDDQJUX.js";
101
101
  import {
102
102
  generateId as generateId2
103
103
  } from "./chunk-BTKQ67RE.js";
@@ -12670,7 +12670,7 @@ var cachedVersion = null;
12670
12670
  function readPackageVersion() {
12671
12671
  if (cachedVersion !== null) return cachedVersion;
12672
12672
  try {
12673
- const injected = "0.5.13";
12673
+ const injected = "0.5.14";
12674
12674
  if (typeof injected === "string" && injected.length > 0) {
12675
12675
  cachedVersion = injected;
12676
12676
  return cachedVersion;
@@ -3,7 +3,7 @@ import {
3
3
  ensureDaemonStateDir,
4
4
  runDashboardRuntimeDaemon,
5
5
  startUdsServer
6
- } from "./chunk-BUNMENOT.js";
6
+ } from "./chunk-XZDDQJUX.js";
7
7
  import "./chunk-BTKQ67RE.js";
8
8
  import {
9
9
  readDashboardClientConfig,
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "hooks",
18
18
  "dashboard"
19
19
  ],
20
- "version": "0.5.13",
20
+ "version": "0.5.14",
21
21
  "license": "MIT",
22
22
  "bin": {
23
23
  "athena": "dist/cli.js",