feat(tui): expand pasted summaries on click#26596
Conversation
|
@kommander @kitlangton review please |
|
/review |
|
review bot cook his ass! |
| }} | ||
| onMouseDown={(r: MouseEvent) => r.target?.focus()} | ||
| onMouseUp={(event: MouseEvent) => { | ||
| if (!expandPasteBlockAtMouse(event)) return |
There was a problem hiding this comment.
Suggestion for the author to decide: this mouse path can still mutate the prompt while props.disabled is true. The rest of this component blocks typing, paste, and submit while disabled, so onMouseUp should probably return before calling expandPasteBlockAtMouse(event) to avoid editing a disabled prompt during permission/question prompts.
|
/review |
| const part = partIndex === undefined ? undefined : store.prompt.parts[partIndex] | ||
| if (part?.type !== "text" || !part.source?.text) return false | ||
|
|
||
| const nextInput = store.prompt.input.slice(0, extmark.start) + part.text + store.prompt.input.slice(extmark.end) |
There was a problem hiding this comment.
Suggestion for the human reviewer to consider: this uses extmark.start/end as JS string indices, and the delta/cursor math uses part.text.length. Textarea offsets elsewhere in this prompt are display-width offsets, so expanding a paste that contains wide graphemes, or appears after wide text, can splice at the wrong point and recreate following extmarks at stale positions. It may be safer to convert display offsets to string indices for slicing and use Bun.stringWidth(part.text) for the delta/cursor math.
I AM MY OWN CAPITAN
Closes: #8501