pi-sage 0.2.7 → 0.2.8
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/.pi/extensions/sage/index.ts +15 -6
- package/package.json +1 -1
|
@@ -756,27 +756,36 @@ async function selectScrollable(
|
|
|
756
756
|
};
|
|
757
757
|
|
|
758
758
|
const handleInput = (data: string): void => {
|
|
759
|
-
|
|
759
|
+
const isUp = data.includes("\u001b[A") || data.includes("\u001bOA");
|
|
760
|
+
const isDown = data.includes("\u001b[B") || data.includes("\u001bOB");
|
|
761
|
+
const isEnter = data.includes("\r") || data.includes("\n") || data.includes("\u001bOM");
|
|
762
|
+
const isEscLike = data.startsWith("\u001b");
|
|
763
|
+
|
|
764
|
+
if (isUp) {
|
|
760
765
|
move(-1);
|
|
761
766
|
return;
|
|
762
767
|
}
|
|
763
|
-
if (
|
|
768
|
+
if (isDown) {
|
|
764
769
|
move(1);
|
|
765
770
|
return;
|
|
766
771
|
}
|
|
767
|
-
if (data === "k") {
|
|
772
|
+
if (data === "k" || data === "K") {
|
|
768
773
|
move(-1);
|
|
769
774
|
return;
|
|
770
775
|
}
|
|
771
|
-
if (data === "j") {
|
|
776
|
+
if (data === "j" || data === "J") {
|
|
772
777
|
move(1);
|
|
773
778
|
return;
|
|
774
779
|
}
|
|
775
|
-
if (
|
|
780
|
+
if (isEnter) {
|
|
776
781
|
done(options[selectedIndex]);
|
|
777
782
|
return;
|
|
778
783
|
}
|
|
779
|
-
if (data
|
|
784
|
+
if (data.includes("\u0003")) {
|
|
785
|
+
done(undefined);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
if (isEscLike) {
|
|
780
789
|
done(undefined);
|
|
781
790
|
}
|
|
782
791
|
};
|