Skip to content

feat(tui): expand pasted summaries on click#26596

Open
R44VC0RP wants to merge 1 commit into
devfrom
feature/expand-paste-summary
Open

feat(tui): expand pasted summaries on click#26596
R44VC0RP wants to merge 1 commit into
devfrom
feature/expand-paste-summary

Conversation

@R44VC0RP

@R44VC0RP R44VC0RP commented May 9, 2026

Copy link
Copy Markdown
Collaborator

I AM MY OWN CAPITAN

Closes: #8501

@R44VC0RP

R44VC0RP commented May 9, 2026

Copy link
Copy Markdown
Collaborator Author

@kommander @kitlangton review please

@R44VC0RP R44VC0RP added the beta label May 10, 2026
@rekram1-node

Copy link
Copy Markdown
Collaborator

/review

@rekram1-node

Copy link
Copy Markdown
Collaborator

review bot cook his ass!

}}
onMouseDown={(r: MouseEvent) => r.target?.focus()}
onMouseUp={(event: MouseEvent) => {
if (!expandPasteBlockAtMouse(event)) return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rekram1-node

Copy link
Copy Markdown
Collaborator

/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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Allow to expand the pasted text (e.g. [Pasted ~1 lines])

2 participants