pi-cc-extensions 0.8.12 → 0.8.14
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/extensions/ask-user-question/state/build-questionnaire.ts +14 -2
- package/extensions/ask-user-question/view/components/preview/preview-layout-decider.ts +7 -0
- package/extensions/claude-code-style.ts +957 -74
- package/extensions/compact-style.ts +4 -2
- package/extensions/context.ts +53 -14
- package/extensions/session-reference.ts +86 -9
- package/extensions/tool-diff/diff-renderer.ts +158 -67
- package/extensions/tool-diff/index.ts +11 -4
- package/extensions/tool-diff/types.ts +7 -1
- package/extensions/tool-result-sanitize.ts +10 -3
- package/package.json +1 -1
|
@@ -188,8 +188,20 @@ class QuestionnaireBuilder {
|
|
|
188
188
|
const questions = this.questions;
|
|
189
189
|
const itemsByTab = this.itemsByTab;
|
|
190
190
|
const tabsDescriptor = questions.map((q) => ({ multiSelect: q.multiSelect }));
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
// Memoize by paneWidth — preview/naturalHeight call this many times per keystroke.
|
|
192
|
+
let cachedPaneWidth: number | undefined;
|
|
193
|
+
let cachedLeftWidth = 0;
|
|
194
|
+
const globalLeftWidth = (paneWidth: number): number => {
|
|
195
|
+
if (cachedPaneWidth === paneWidth) return cachedLeftWidth;
|
|
196
|
+
cachedLeftWidth = crossTabLeftWidthWithDonation(
|
|
197
|
+
tabsDescriptor,
|
|
198
|
+
itemsByTab,
|
|
199
|
+
questions,
|
|
200
|
+
paneWidth,
|
|
201
|
+
);
|
|
202
|
+
cachedPaneWidth = paneWidth;
|
|
203
|
+
return cachedLeftWidth;
|
|
204
|
+
};
|
|
193
205
|
for (const tab of tabs) {
|
|
194
206
|
tab.preview.setGlobalLeftWidth(globalLeftWidth);
|
|
195
207
|
}
|
|
@@ -104,7 +104,13 @@ export function crossTabMaxLeftWidth(
|
|
|
104
104
|
*
|
|
105
105
|
* Pure function — O(total chars) per question; no Markdown invocation, no cache interaction.
|
|
106
106
|
*/
|
|
107
|
+
/** Per-question widest preview line; questions are immutable for a dialog lifetime. */
|
|
108
|
+
const previewSourceWidthCache = new WeakMap<QuestionData, number>();
|
|
109
|
+
|
|
107
110
|
export function previewSourceWidth(question: QuestionData): number {
|
|
111
|
+
const cached = previewSourceWidthCache.get(question);
|
|
112
|
+
if (cached !== undefined) return cached;
|
|
113
|
+
|
|
108
114
|
let max = 0;
|
|
109
115
|
for (const option of question.options) {
|
|
110
116
|
const text = option.preview;
|
|
@@ -114,6 +120,7 @@ export function previewSourceWidth(question: QuestionData): number {
|
|
|
114
120
|
if (w > max) max = w;
|
|
115
121
|
}
|
|
116
122
|
}
|
|
123
|
+
previewSourceWidthCache.set(question, max);
|
|
117
124
|
return max;
|
|
118
125
|
}
|
|
119
126
|
|