@scania/tegel-lite 0.0.3-rules-beta.6 → 0.0.3-rules-beta.9
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/bin/setup-ai-rules.js +10 -10
- package/package.json +1 -1
package/bin/setup-ai-rules.js
CHANGED
|
@@ -109,7 +109,7 @@ function askYesNo(rl, question) {
|
|
|
109
109
|
*/
|
|
110
110
|
function showCheckboxList(items) {
|
|
111
111
|
return new Promise((resolve) => {
|
|
112
|
-
const selected = items.map(() =>
|
|
112
|
+
const selected = items.map(() => false); // Nothing selected by default
|
|
113
113
|
let cursor = 0;
|
|
114
114
|
|
|
115
115
|
const { stdin, stdout } = process;
|
|
@@ -142,14 +142,14 @@ function showCheckboxList(items) {
|
|
|
142
142
|
function rerender() {
|
|
143
143
|
if (rendered) {
|
|
144
144
|
// Move up to overwrite previous output
|
|
145
|
-
// items.length + 1 (empty line) + 1 (help text) +
|
|
146
|
-
const lineCount = items.length +
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
// render() produces items.length (items) + 1 (empty line) + 1 (help text) = items.length + 2 lines
|
|
146
|
+
const lineCount = items.length + 2;
|
|
147
|
+
// Use ANSI escape codes in single write for atomic update
|
|
148
|
+
stdout.write(`\x1B[${lineCount}A\x1B[J${render()}\n`);
|
|
149
|
+
} else {
|
|
150
|
+
stdout.write(render());
|
|
151
|
+
stdout.write('\n');
|
|
149
152
|
}
|
|
150
|
-
|
|
151
|
-
stdout.write(render());
|
|
152
|
-
stdout.write('\n');
|
|
153
153
|
rendered = true;
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -182,8 +182,8 @@ function showCheckboxList(items) {
|
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
// Space → toggle current item
|
|
186
|
-
if (key.name === 'space') {
|
|
185
|
+
// Space → toggle current item (check both key.name and key.sequence for compatibility)
|
|
186
|
+
if (key.name === 'space' || key.sequence === ' ') {
|
|
187
187
|
selected[cursor] = !selected[cursor];
|
|
188
188
|
}
|
|
189
189
|
|