groundcrew-cli 0.16.4 → 0.16.6

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.
package/dist/index.js CHANGED
@@ -500,6 +500,7 @@ function readMultilineInput(sessionId, projectName, gitCtx, sessionDir) {
500
500
  let crow = 0;
501
501
  let ccol = 0;
502
502
  const padWidth = sessionId.length + 5;
503
+ const linePad = (i) => i === 0 ? padWidth : 0;
503
504
  let lastTermRow = 0;
504
505
  let pasteBuffer = "";
505
506
  let isPasting = false;
@@ -523,7 +524,7 @@ function readMultilineInput(sessionId, projectName, gitCtx, sessionDir) {
523
524
  if (i === 0) {
524
525
  buf.push(dim(`[${sessionId}]`) + " " + bold(">") + " " + lines[i]);
525
526
  } else {
526
- buf.push(" ".repeat(padWidth) + lines[i]);
527
+ buf.push(lines[i]);
527
528
  }
528
529
  }
529
530
  let suggestionRows = 0;
@@ -539,12 +540,24 @@ function readMultilineInput(sessionId, projectName, gitCtx, sessionDir) {
539
540
  }
540
541
  }
541
542
  const lastRow = lines.length - 1;
542
- const rowsUp = lastRow - crow + suggestionRows;
543
- if (rowsUp > 0) buf.push(`\x1B[${rowsUp}A`);
543
+ const termRowsForLine = (i) => {
544
+ const lineLen = linePad(i) + lines[i].length;
545
+ return lineLen === 0 ? 1 : Math.max(1, Math.ceil(lineLen / termW));
546
+ };
547
+ let rowsBelowCursor = suggestionRows;
548
+ for (let i = lastRow; i > crow; i--) rowsBelowCursor += termRowsForLine(i);
549
+ const cursorLineTermRows = termRowsForLine(crow);
550
+ const cursorPad = linePad(crow);
551
+ const cursorRowWithinLine = Math.floor((cursorPad + ccol) / termW);
552
+ rowsBelowCursor += cursorLineTermRows - 1 - cursorRowWithinLine;
553
+ if (rowsBelowCursor > 0) buf.push(`\x1B[${rowsBelowCursor}A`);
544
554
  buf.push("\r");
545
- const col = padWidth + ccol;
555
+ const col = (cursorPad + ccol) % termW;
546
556
  if (col > 0) buf.push(`\x1B[${col}C`);
547
- lastTermRow = 1 + crow;
557
+ let rowsAbove = 1;
558
+ for (let i = 0; i < crow; i++) rowsAbove += termRowsForLine(i);
559
+ rowsAbove += cursorRowWithinLine;
560
+ lastTermRow = rowsAbove;
548
561
  process.stdout.write(buf.join(""));
549
562
  };
550
563
  const finish = (result) => {
@@ -561,7 +574,7 @@ function readMultilineInput(sessionId, projectName, gitCtx, sessionDir) {
561
574
  if (i === 0) {
562
575
  buf.push(dim(`[${sessionId}]`) + " " + bold(">") + " " + lines[i]);
563
576
  } else {
564
- buf.push(" ".repeat(padWidth) + lines[i]);
577
+ buf.push(lines[i]);
565
578
  }
566
579
  }
567
580
  buf.push("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groundcrew-cli",
3
- "version": "0.16.4",
3
+ "version": "0.16.6",
4
4
  "description": "CLI companion for Groundcrew — queue tasks, send feedback, monitor your Copilot agent from another terminal.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -647,6 +647,7 @@ function readMultilineInput(sessionId: string, projectName: string, gitCtx: { br
647
647
 
648
648
  // Visible width of prompt: "[sessionId] > "
649
649
  const padWidth = sessionId.length + 5; // [ + id + ] + space + > + space = len+5
650
+ const linePad = (i: number) => i === 0 ? padWidth : 0;
650
651
 
651
652
  // Track how many rows up from cursor to top of rendered area (including separator)
652
653
  let lastTermRow = 0;
@@ -680,7 +681,7 @@ function readMultilineInput(sessionId: string, projectName: string, gitCtx: { br
680
681
  if (i === 0) {
681
682
  buf.push(dim(`[${sessionId}]`) + " " + bold(">") + " " + lines[i]);
682
683
  } else {
683
- buf.push(" ".repeat(padWidth) + lines[i]);
684
+ buf.push(lines[i]);
684
685
  }
685
686
  }
686
687
 
@@ -699,17 +700,34 @@ function readMultilineInput(sessionId: string, projectName: string, gitCtx: { br
699
700
 
700
701
  // Position cursor at (crow, ccol)
701
702
  const lastRow = lines.length - 1;
702
- // Position cursor at (crow, ccol) — move up past remaining input lines + suggestions
703
- const rowsUp = (lastRow - crow) + suggestionRows;
704
- if (rowsUp > 0) buf.push(`\x1b[${rowsUp}A`);
703
+
704
+ // Calculate actual terminal rows each line occupies (for wrapped lines)
705
+ const termRowsForLine = (i: number): number => {
706
+ const lineLen = linePad(i) + lines[i].length;
707
+ return lineLen === 0 ? 1 : Math.max(1, Math.ceil(lineLen / termW));
708
+ };
709
+
710
+ // Move up from the end of the last drawn line to the cursor position
711
+ // Count terminal rows below cursor line (remaining input lines + suggestions)
712
+ let rowsBelowCursor = suggestionRows;
713
+ for (let i = lastRow; i > crow; i--) rowsBelowCursor += termRowsForLine(i);
714
+ // Add any extra wrapped rows on the cursor line itself (below the cursor's row within wraps)
715
+ const cursorLineTermRows = termRowsForLine(crow);
716
+ const cursorPad = linePad(crow);
717
+ const cursorRowWithinLine = Math.floor((cursorPad + ccol) / termW);
718
+ rowsBelowCursor += (cursorLineTermRows - 1 - cursorRowWithinLine);
719
+
720
+ if (rowsBelowCursor > 0) buf.push(`\x1b[${rowsBelowCursor}A`);
705
721
 
706
722
  buf.push("\r");
707
- const col = padWidth + ccol;
723
+ const col = (cursorPad + ccol) % termW;
708
724
  if (col > 0) buf.push(`\x1b[${col}C`);
709
725
 
710
- // lastTermRow = rows above cursor (separator + input lines above crow)
711
- // Suggestion rows below cursor are cleared by \x1b[J on next render
712
- lastTermRow = 1 + crow;
726
+ // lastTermRow = terminal rows above cursor (separator + wrapped input lines above crow + cursor's wrapped rows above)
727
+ let rowsAbove = 1; // separator line
728
+ for (let i = 0; i < crow; i++) rowsAbove += termRowsForLine(i);
729
+ rowsAbove += cursorRowWithinLine;
730
+ lastTermRow = rowsAbove;
713
731
  process.stdout.write(buf.join(""));
714
732
  };
715
733
 
@@ -731,7 +749,7 @@ function readMultilineInput(sessionId: string, projectName: string, gitCtx: { br
731
749
  if (i === 0) {
732
750
  buf.push(dim(`[${sessionId}]`) + " " + bold(">") + " " + lines[i]);
733
751
  } else {
734
- buf.push(" ".repeat(padWidth) + lines[i]);
752
+ buf.push(lines[i]);
735
753
  }
736
754
  }
737
755
  buf.push("\n");