groundcrew-cli 0.16.4 → 0.16.5

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
@@ -539,12 +539,23 @@ function readMultilineInput(sessionId, projectName, gitCtx, sessionDir) {
539
539
  }
540
540
  }
541
541
  const lastRow = lines.length - 1;
542
- const rowsUp = lastRow - crow + suggestionRows;
543
- if (rowsUp > 0) buf.push(`\x1B[${rowsUp}A`);
542
+ const termRowsForLine = (i) => {
543
+ const lineLen = (i === 0 ? padWidth : padWidth) + lines[i].length;
544
+ return lineLen === 0 ? 1 : Math.max(1, Math.ceil(lineLen / termW));
545
+ };
546
+ let rowsBelowCursor = suggestionRows;
547
+ for (let i = lastRow; i > crow; i--) rowsBelowCursor += termRowsForLine(i);
548
+ const cursorLineTermRows = termRowsForLine(crow);
549
+ const cursorRowWithinLine = Math.floor((padWidth + ccol) / termW);
550
+ rowsBelowCursor += cursorLineTermRows - 1 - cursorRowWithinLine;
551
+ if (rowsBelowCursor > 0) buf.push(`\x1B[${rowsBelowCursor}A`);
544
552
  buf.push("\r");
545
- const col = padWidth + ccol;
553
+ const col = (padWidth + ccol) % termW;
546
554
  if (col > 0) buf.push(`\x1B[${col}C`);
547
- lastTermRow = 1 + crow;
555
+ let rowsAbove = 1;
556
+ for (let i = 0; i < crow; i++) rowsAbove += termRowsForLine(i);
557
+ rowsAbove += cursorRowWithinLine;
558
+ lastTermRow = rowsAbove;
548
559
  process.stdout.write(buf.join(""));
549
560
  };
550
561
  const finish = (result) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groundcrew-cli",
3
- "version": "0.16.4",
3
+ "version": "0.16.5",
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
@@ -699,17 +699,33 @@ function readMultilineInput(sessionId: string, projectName: string, gitCtx: { br
699
699
 
700
700
  // Position cursor at (crow, ccol)
701
701
  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`);
702
+
703
+ // Calculate actual terminal rows each line occupies (for wrapped lines)
704
+ const termRowsForLine = (i: number): number => {
705
+ const lineLen = (i === 0 ? padWidth : padWidth) + lines[i].length;
706
+ return lineLen === 0 ? 1 : Math.max(1, Math.ceil(lineLen / termW));
707
+ };
708
+
709
+ // Move up from the end of the last drawn line to the cursor position
710
+ // Count terminal rows below cursor line (remaining input lines + suggestions)
711
+ let rowsBelowCursor = suggestionRows;
712
+ for (let i = lastRow; i > crow; i--) rowsBelowCursor += termRowsForLine(i);
713
+ // Add any extra wrapped rows on the cursor line itself (below the cursor's row within wraps)
714
+ const cursorLineTermRows = termRowsForLine(crow);
715
+ const cursorRowWithinLine = Math.floor((padWidth + ccol) / termW);
716
+ rowsBelowCursor += (cursorLineTermRows - 1 - cursorRowWithinLine);
717
+
718
+ if (rowsBelowCursor > 0) buf.push(`\x1b[${rowsBelowCursor}A`);
705
719
 
706
720
  buf.push("\r");
707
- const col = padWidth + ccol;
721
+ const col = (padWidth + ccol) % termW;
708
722
  if (col > 0) buf.push(`\x1b[${col}C`);
709
723
 
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;
724
+ // lastTermRow = terminal rows above cursor (separator + wrapped input lines above crow + cursor's wrapped rows above)
725
+ let rowsAbove = 1; // separator line
726
+ for (let i = 0; i < crow; i++) rowsAbove += termRowsForLine(i);
727
+ rowsAbove += cursorRowWithinLine;
728
+ lastTermRow = rowsAbove;
713
729
  process.stdout.write(buf.join(""));
714
730
  };
715
731