@shnitzel/plugscout 0.3.21 → 0.3.22
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.
|
@@ -1146,12 +1146,11 @@ async function promptResultBrowser(entries) {
|
|
|
1146
1146
|
const WINDOW = 8;
|
|
1147
1147
|
let selected = 0;
|
|
1148
1148
|
let linesDrawn = 0;
|
|
1149
|
-
const ARROW_UP = '[A';
|
|
1150
|
-
const ARROW_DOWN = '[B';
|
|
1151
1149
|
const ENTER = '\r';
|
|
1152
1150
|
const CTRL_C = '';
|
|
1153
1151
|
const Q = 'q';
|
|
1154
|
-
|
|
1152
|
+
function isUp(key) { return key === '[A' || key === '\x1b[A'; }
|
|
1153
|
+
function isDown(key) { return key === '[B' || key === '\x1b[B'; }
|
|
1155
1154
|
function visibleStart() {
|
|
1156
1155
|
return Math.max(0, Math.min(selected - Math.floor(WINDOW / 2), entries.length - WINDOW));
|
|
1157
1156
|
}
|
|
@@ -1194,18 +1193,18 @@ async function promptResultBrowser(entries) {
|
|
|
1194
1193
|
renderBrowser(true);
|
|
1195
1194
|
const action = await new Promise((resolve) => {
|
|
1196
1195
|
process.stdin.on('data', function onKey(key) {
|
|
1197
|
-
if (key === CTRL_C || key === Q
|
|
1196
|
+
if (key === CTRL_C || key === Q) {
|
|
1198
1197
|
process.stdin.removeListener('data', onKey);
|
|
1199
1198
|
process.stdin.setRawMode(false);
|
|
1200
1199
|
process.stdin.pause();
|
|
1201
1200
|
process.stdout.write('\n');
|
|
1202
1201
|
resolve({ exit: true });
|
|
1203
1202
|
}
|
|
1204
|
-
else if (key
|
|
1203
|
+
else if (isUp(key)) {
|
|
1205
1204
|
selected = (selected - 1 + entries.length) % entries.length;
|
|
1206
1205
|
renderBrowser(false);
|
|
1207
1206
|
}
|
|
1208
|
-
else if (key
|
|
1207
|
+
else if (isDown(key)) {
|
|
1209
1208
|
selected = (selected + 1) % entries.length;
|
|
1210
1209
|
renderBrowser(false);
|
|
1211
1210
|
}
|
package/package.json
CHANGED