Skip to content

route TUI editor input by owning-view focus#13771

Merged
harryalbert merged 1 commit into
masterfrom
harry/code-1822-focus-routing
Jul 16, 2026
Merged

route TUI editor input by owning-view focus#13771
harryalbert merged 1 commit into
masterfrom
harry/code-1822-focus-routing

Conversation

@harryalbert

@harryalbert harryalbert commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

This PR updates tracking so that the TuiInputView (and other TUI views going forward) owns focus via on_focus/on_blur and snapshots that state into TuiEditorElement. Editable TUI editors now consume raw text and paste events, and render the terminal cursor, only while their owning view is focused. This prevents multiple editable elements rendered at once from contending for the same input.

This follows the GUI editor's existing pattern: EditorView snapshots its focus state into ViewSnapshot, and EditorElement::typed_characters declines text when that snapshot is not focused. The TUI now uses the same view-to-element focus boundary instead of allowing every editable element to handle raw input.

We're doing this now so that, upstack when we add the search input to the options element, we can do so with clear focus tracking for that input.

Testing

  • I have manually tested my changes locally with ./script/run-tui
    Again, no behavior changes yet

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

harryalbert commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@harryalbert
harryalbert force-pushed the harry/code-1822-focus-routing branch from a0ee2eb to f3c7f42 Compare July 15, 2026 16:34
@harryalbert
harryalbert force-pushed the harry/code-1822-option-snapshots branch from bf39ff7 to 9f1f151 Compare July 15, 2026 16:34
@harryalbert harryalbert changed the title Route TUI raw text input by focus, GUI-style route TUI editor input by owning-view focus Jul 15, 2026
@harryalbert
harryalbert requested a review from moirahuang July 15, 2026 16:59
@harryalbert
harryalbert marked this pull request as ready for review July 15, 2026 16:59
@harryalbert
harryalbert force-pushed the harry/code-1822-option-snapshots branch from 9f1f151 to 8ecadc5 Compare July 15, 2026 16:59
@harryalbert
harryalbert force-pushed the harry/code-1822-focus-routing branch from f3c7f42 to 1d2cca1 Compare July 15, 2026 16:59
@oz-for-oss

oz-for-oss Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@harryalbert

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

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.

Overview

This PR adds owning-view focus tracking for TuiInputView and snapshots it into TuiEditorElement so editable TUI elements only render the terminal cursor and consume raw text/paste while focused.

Concerns

  • This is a user-facing TUI behavior change, but the PR only states manual testing with ./script/run-tui; it does not attach an acceptable TUI evidence artifact such as a terminal transcript, render_to_lines/TuiBuffer::to_lines snapshot diff, or ./script/run-tui capture. Please include terminal evidence demonstrating the focus-routing behavior end to end.

Verdict

Found: 0 critical, 1 important, 1 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread crates/warp_tui/src/editor_element_tests.rs
@harryalbert
harryalbert force-pushed the harry/code-1822-focus-routing branch from 1d2cca1 to 991c04e Compare July 16, 2026 02:44
@harryalbert harryalbert mentioned this pull request Jul 16, 2026
4 tasks
Base automatically changed from harry/code-1822-option-snapshots to master July 16, 2026 12:01
@harryalbert
harryalbert force-pushed the harry/code-1822-focus-routing branch from 991c04e to 71a3e79 Compare July 16, 2026 12:44
@harryalbert
harryalbert merged commit 0993c31 into master Jul 16, 2026
40 of 42 checks passed
@harryalbert
harryalbert deleted the harry/code-1822-focus-routing branch July 16, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants