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.
@@ -756,27 +756,36 @@ async function selectScrollable(
756
756
  };
757
757
 
758
758
  const handleInput = (data: string): void => {
759
- if (data.includes("\u001b[A")) {
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 (data.includes("\u001b[B")) {
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 (data === "\r" || data === "\n") {
780
+ if (isEnter) {
776
781
  done(options[selectedIndex]);
777
782
  return;
778
783
  }
779
- if (data === "\u001b") {
784
+ if (data.includes("\u0003")) {
785
+ done(undefined);
786
+ return;
787
+ }
788
+ if (isEscLike) {
780
789
  done(undefined);
781
790
  }
782
791
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-sage",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Interactive-only advisory Sage extension for Pi",