@juicesharp/rpiv-ask-user-question 2.13.0 → 2.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-ask-user-question",
3
- "version": "2.13.0",
3
+ "version": "2.13.1",
4
4
  "description": "Pi extension. A structured questionnaire the model can put to you when it would otherwise guess, with typed options instead of free-form replies.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -97,6 +97,6 @@
97
97
  }
98
98
  },
99
99
  "dependencies": {
100
- "@juicesharp/rpiv-config": "^2.13.0"
100
+ "@juicesharp/rpiv-config": "^2.13.1"
101
101
  }
102
102
  }
@@ -94,18 +94,31 @@ function computeScrollStart(
94
94
  return Math.max(0, Math.min(idealStart, middleRows - availableMiddle));
95
95
  }
96
96
 
97
- /** Mark the scroll window edges with overflow arrows; combined ↕ on a single-row middle. */
98
- function decorateOverflow(scrollableMiddle: string[], hasUp: boolean, hasDown: boolean, theme: Theme): void {
97
+ /**
98
+ * Mark the scroll window edges with overflow arrows; combined ↕ on a single-row middle.
99
+ * An arrow replaces the row it lands on, so rows inside `protectedRows` (the focused item,
100
+ * in window coordinates, end-exclusive) are never drawn over — losing the affordance beats
101
+ * losing the row the user is on (#261).
102
+ */
103
+ function decorateOverflow(
104
+ scrollableMiddle: string[],
105
+ hasUp: boolean,
106
+ hasDown: boolean,
107
+ theme: Theme,
108
+ protectedRows: readonly [number, number] | undefined,
109
+ ): void {
110
+ const drawable = (row: number) => !protectedRows || row < protectedRows[0] || row >= protectedRows[1];
99
111
  if (hasUp && hasDown && scrollableMiddle.length === 1) {
100
112
  // Single-row middle: combined ↕ avoids the prior collision where ↓ overwrote ↑.
101
- scrollableMiddle[0] = theme.fg("dim", OVERFLOW_BOTH);
113
+ if (drawable(0)) scrollableMiddle[0] = theme.fg("dim", OVERFLOW_BOTH);
102
114
  return;
103
115
  }
104
- if (hasUp && scrollableMiddle.length > 0) {
116
+ if (hasUp && scrollableMiddle.length > 0 && drawable(0)) {
105
117
  scrollableMiddle[0] = theme.fg("dim", OVERFLOW_UP);
106
118
  }
107
- if (hasDown && scrollableMiddle.length > 0) {
108
- scrollableMiddle[scrollableMiddle.length - 1] = theme.fg("dim", OVERFLOW_DOWN);
119
+ const last = scrollableMiddle.length - 1;
120
+ if (hasDown && last > 0 && drawable(last)) {
121
+ scrollableMiddle[last] = theme.fg("dim", OVERFLOW_DOWN);
109
122
  }
110
123
  }
111
124
 
@@ -222,8 +235,11 @@ export class DialogView implements StatefulView<DialogProps> {
222
235
 
223
236
  const termRows = this.config.getTerminalRows();
224
237
 
225
- if (natural.length + spacerRows <= termRows) {
226
- return renderFitsTerminal(natural, spacerRows);
238
+ // The spacer is padding for a stable cross-tab footprint, not content: when only the
239
+ // padding overflows, clamp it rather than entering the scroll partition, which assumes
240
+ // the middle region itself is longer than the window (#260).
241
+ if (natural.length <= termRows) {
242
+ return renderFitsTerminal(natural, Math.min(spacerRows, termRows - natural.length));
227
243
  }
228
244
 
229
245
  // OVERFLOW — apply 3-region partition with scroll-to-focus. The heading joins the
@@ -239,18 +255,23 @@ export class DialogView implements StatefulView<DialogProps> {
239
255
  return renderChromeOnly(natural, top, bottomFixed, termRows);
240
256
  }
241
257
 
242
- const scrollStart = computeScrollStart(
243
- strategy.focusedItemRowRange(width, state),
244
- pinHeading ? 0 : headingHeight,
245
- availableMiddle,
246
- middleRows,
247
- );
248
- const scrollableMiddle = natural.slice(top + scrollStart, top + scrollStart + availableMiddle);
258
+ // Never slice past the middle region into the bottom-fixed rows, which are appended
259
+ // below — that would draw the bottom border and hint twice (#260).
260
+ const windowRows = Math.min(availableMiddle, middleRows);
261
+ const rowsBeforeBody = pinHeading ? 0 : headingHeight;
262
+ const focusedRange = strategy.focusedItemRowRange(width, state);
263
+ const scrollStart = computeScrollStart(focusedRange, rowsBeforeBody, windowRows, middleRows);
264
+ const scrollableMiddle = natural.slice(top + scrollStart, top + scrollStart + windowRows);
265
+ const focusedInWindow: [number, number] | undefined = focusedRange && [
266
+ rowsBeforeBody + focusedRange[0] - scrollStart,
267
+ rowsBeforeBody + focusedRange[1] - scrollStart,
268
+ ];
249
269
  decorateOverflow(
250
270
  scrollableMiddle,
251
271
  scrollStart > 0,
252
- scrollStart + availableMiddle < middleRows,
272
+ scrollStart + windowRows < middleRows,
253
273
  this.config.theme,
274
+ focusedInWindow,
254
275
  );
255
276
 
256
277
  const result = [...natural.slice(0, top), ...scrollableMiddle, ...natural.slice(natural.length - bottomFixed)];
@@ -243,7 +243,9 @@ export class SubmitTabStrategy implements TabContentStrategy {
243
243
  "warning",
244
244
  `${t("review.incomplete", INCOMPLETE_WARNING_PREFIX)} ${missing.join(", ")}`,
245
245
  );
246
- const out: Component[] = [new Spacer(1), new Text(promptText, 1, 0)];
246
+ // One row, never wrapped: `footerRowCount` counts it as one, and a wrapped prompt
247
+ // (long list of unanswered headers) would desync the chrome's row math (#261).
248
+ const out: Component[] = [new Spacer(1), new OneLineClippedText(promptText, 1)];
247
249
  if (this.config.submitPicker) {
248
250
  out.push(this.config.submitPicker);
249
251
  } else {