Skip to content

[FEATURE]: TUI plugins have no way to read or drive the prompt #38962

Description

@iceteaSA

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

TUI plugins can render into slots, but they cannot read what the user is typing, edit it, move the cursor, or annotate a span of it. Anything that wants to complete, rewrite, validate, or highlight prompt text has no supported surface — the TextareaRenderable is internal to the prompt component.

Suggested behaviour

A plugin-facing prompt facade: read prompt state, replace a text range, drive the cursor, draw extmarks (underlined spans), and subscribe to prompt/cursor changes.

The awkward part is lifetime, and it is worth designing for rather than discovering later. The prompt remounts on session switches and route changes, so a plugin that captured a ref at load time is holding a destroyed controller. A facade that hands out the component ref directly will produce crashes in plugin code that looks correct.

Related edges that need an explicit answer rather than incidental behaviour:

  • what a range replacement does when start > end
  • whether offsets are byte, codepoint, or display-width, and how they snap to grapheme boundaries
  • whether an existing extmark survives an edit that overlaps it
  • what a screen-coordinate lookup returns when the prompt is unmounted or not yet laid out

Version

v1.18.5

Additional context

PR #38955 implements this (draft — the API shape is worth maintainer input before it becomes public surface).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions