groundcrew-cli 0.16.0 → 0.16.1
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 +18 -2
- package/package.json +1 -1
- package/src/index.ts +21 -2
package/dist/index.js
CHANGED
|
@@ -638,12 +638,28 @@ function readMultilineInput(sessionId, projectName, gitCtx) {
|
|
|
638
638
|
continue;
|
|
639
639
|
}
|
|
640
640
|
if (str[i] === "\x1B" && i + 1 < str.length && str[i + 1] === "[") {
|
|
641
|
-
const csiMatch = str.slice(i).match(/^\x1b\[(\d+)
|
|
641
|
+
const csiMatch = str.slice(i).match(/^\x1b\[(\d+)(?:;(\d+))?u/);
|
|
642
642
|
if (csiMatch) {
|
|
643
643
|
const codepoint = parseInt(csiMatch[1], 10);
|
|
644
|
-
const modifier = parseInt(csiMatch[2], 10);
|
|
644
|
+
const modifier = csiMatch[2] ? parseInt(csiMatch[2], 10) : 1;
|
|
645
645
|
const isCtrl = modifier - 1 & 4;
|
|
646
646
|
const seqLen = csiMatch[0].length;
|
|
647
|
+
if (!isCtrl && modifier <= 1) {
|
|
648
|
+
switch (codepoint) {
|
|
649
|
+
case 9:
|
|
650
|
+
str = str.slice(0, i) + " " + str.slice(i + seqLen);
|
|
651
|
+
continue;
|
|
652
|
+
case 13:
|
|
653
|
+
str = str.slice(0, i) + "\r" + str.slice(i + seqLen);
|
|
654
|
+
continue;
|
|
655
|
+
case 27:
|
|
656
|
+
i += seqLen;
|
|
657
|
+
continue;
|
|
658
|
+
case 127:
|
|
659
|
+
str = str.slice(0, i) + "\x7F" + str.slice(i + seqLen);
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
647
663
|
if (isCtrl) {
|
|
648
664
|
switch (codepoint) {
|
|
649
665
|
case 99:
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -784,15 +784,34 @@ function readMultilineInput(sessionId: string, projectName: string, gitCtx: { br
|
|
|
784
784
|
if (str.startsWith("\x1b[F", i)) { ccol = lines[crow].length; render(); i += 3; continue; }
|
|
785
785
|
|
|
786
786
|
// CSI u (Kitty keyboard protocol) — decode \x1b[{codepoint};{modifier}u
|
|
787
|
+
// Also handles single-param \x1b[{codepoint}u (unmodified key)
|
|
787
788
|
// modifier bit 3 (value 4) = Ctrl, sent as bits+1 so modifier 5 = Ctrl
|
|
788
789
|
if (str[i] === "\x1b" && i + 1 < str.length && str[i + 1] === "[") {
|
|
789
|
-
const csiMatch = str.slice(i).match(/^\x1b\[(\d+)
|
|
790
|
+
const csiMatch = str.slice(i).match(/^\x1b\[(\d+)(?:;(\d+))?u/);
|
|
790
791
|
if (csiMatch) {
|
|
791
792
|
const codepoint = parseInt(csiMatch[1], 10);
|
|
792
|
-
const modifier = parseInt(csiMatch[2], 10);
|
|
793
|
+
const modifier = csiMatch[2] ? parseInt(csiMatch[2], 10) : 1;
|
|
793
794
|
const isCtrl = (modifier - 1) & 4;
|
|
794
795
|
const seqLen = csiMatch[0].length;
|
|
795
796
|
|
|
797
|
+
// Handle unmodified functional keys encoded as CSI u
|
|
798
|
+
if (!isCtrl && modifier <= 1) {
|
|
799
|
+
switch (codepoint) {
|
|
800
|
+
case 9: // Tab (unmodified)
|
|
801
|
+
// Delegate to Tab handler by injecting \t
|
|
802
|
+
str = str.slice(0, i) + "\t" + str.slice(i + seqLen);
|
|
803
|
+
continue;
|
|
804
|
+
case 13: // Enter (unmodified)
|
|
805
|
+
str = str.slice(0, i) + "\r" + str.slice(i + seqLen);
|
|
806
|
+
continue;
|
|
807
|
+
case 27: // Escape (unmodified)
|
|
808
|
+
i += seqLen; continue;
|
|
809
|
+
case 127: // Backspace (unmodified)
|
|
810
|
+
str = str.slice(0, i) + "\x7f" + str.slice(i + seqLen);
|
|
811
|
+
continue;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
796
815
|
if (isCtrl) {
|
|
797
816
|
switch (codepoint) {
|
|
798
817
|
case 99: // Ctrl+C
|