@hank-warren/pi-ask-user-question 0.5.1 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @hank-warren/pi-ask-user-question
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3fbf632: Make backspace delete a whole character rather than half a surrogate pair. Both text-entry surfaces sliced UTF-16 code units, so one backspace after an emoji left a lone surrogate — an ill-formed string that was then submitted as an approval note or a free-text answer.
8
+
9
+ `pi-permission-selector` adds a code-point-aware `removeLastCharacter` export (additive; the frozen shared surface gains a name and loses none), and `pi-ask-user-question` uses it for the custom-answer field.
10
+
11
+ - Updated dependencies [3fbf632]
12
+ - @hank-warren/pi-permission-selector@1.3.0
13
+
3
14
  ## 0.5.1
4
15
 
5
16
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hank-warren/pi-ask-user-question",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Structured questionnaire tool for Pi with numbered options, digit hotkeys and Tab-to-comment, composed from the shared permission-selector component.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  "CHANGELOG.md"
47
47
  ],
48
48
  "dependencies": {
49
- "@hank-warren/pi-permission-selector": "^1.2.0"
49
+ "@hank-warren/pi-permission-selector": "^1.3.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@earendil-works/pi-coding-agent": "*",
package/view/dialog.ts CHANGED
@@ -49,6 +49,7 @@ import {
49
49
  isRightKey,
50
50
  isShiftTabKey,
51
51
  isTabKey,
52
+ removeLastCharacter,
52
53
  } from "@hank-warren/pi-permission-selector/keys.ts";
53
54
  import { OptionSelector, type SelectorOption } from "@hank-warren/pi-permission-selector/selector.ts";
54
55
  import {
@@ -426,7 +427,9 @@ export class QuestionnaireDialog {
426
427
  return;
427
428
  }
428
429
  if (isBackspaceKey(keyData)) {
429
- tab.customText = tab.customText.slice(0, -1);
430
+ // Code-point aware: a UTF-16 slice would split a surrogate pair and
431
+ // leave a lone surrogate in the answer that reaches the model.
432
+ tab.customText = removeLastCharacter(tab.customText);
430
433
  this.repaint();
431
434
  return;
432
435
  }