Skip to content

add generalized virtualized viewport element#13177

Merged
harryalbert merged 26 commits into
masterfrom
harry/tui-viewport-element
Jun 30, 2026
Merged

add generalized virtualized viewport element#13177
harryalbert merged 26 commits into
masterfrom
harry/tui-viewport-element

Conversation

@harryalbert

@harryalbert harryalbert commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a generalized viewport element that takes caller-owned ordered-height index/cursor, and handles rendering only the visible rows in an efficient way (and keeping scroll position stable through resizes). This viewport will serve as the backing element to render the blocklist, without being blocklist-specific (any other caller could provide a sum tree and set of items and get the same efficient rendering for free). This PR also adds some smaller helpers to allow for generalized item clipping and scrollable behavior, and handling for scroll mouse events.

The big things to read in this PR are:

  • crates/warpui_core/src/elements/tui/viewported_list.rs
    • New generic virtualized list / viewport.
  • crates/warpui_core/src/elements/tui/scrollable.rs
    • New wheel-scroll wrapper.
  • crates/warpui_core/src/elements/tui/clipped.rs
    • New vertical row clipping wrapper.
  • crates/warpui_core/src/runtime/event_conversion.rs
    • Adds crossterm mouse/wheel conversion into Warp’s shared Event.
  • crates/warpui_core/src/elements/tui/event.rs
    • Changes TUI event context from queued “app updates” to view notifications.
  • crates/warpui_core/examples/tui_viewport_demo.rs
    • Manual harness demonstrating the pieces together.

Testing

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

Running the demo added in this PR:
https://www.loom.com/share/dd626bbe4c2e470da975b44c5d80ab15

Agent Mode

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

harryalbert commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Base automatically changed from harry/conversation-streaming-for-tui to master June 29, 2026 14:09
@harryalbert harryalbert force-pushed the harry/tui-viewport-element branch 2 times, most recently from 40dbb8a to f2ab35d Compare June 29, 2026 16:55
@harryalbert harryalbert marked this pull request as ready for review June 29, 2026 17:25
@harryalbert harryalbert requested a review from kevinyang372 June 29, 2026 17:25
@oz-for-oss

oz-for-oss Bot commented Jun 29, 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

@harryalbert harryalbert changed the title feat(tui): generalized virtualized viewport element + demo generalized virtualized viewport element + demo Jun 29, 2026
@harryalbert harryalbert changed the title generalized virtualized viewport element + demo generalized virtualized viewport element Jun 29, 2026

@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 a generalized TUI virtualized viewport stack, including clipping, wheel-scroll wrapping, mouse event conversion, a demo harness, tests, and an accompanying technical spec. I reviewed the attached annotated diff, PR description, and spec context; no approved repository spec context was available for implementation matching.

Concerns

  • No blocking correctness, security, error-handling, or performance concerns found in the changed diff.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

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

Powered by Oz

@harryalbert harryalbert force-pushed the harry/tui-viewport-element branch from 707ebfa to d914567 Compare June 29, 2026 18:49
@harryalbert harryalbert changed the title generalized virtualized viewport element add generalized virtualized viewport element Jun 29, 2026
harryalbert and others added 15 commits June 29, 2026 17:26
Adds a content-agnostic TUI viewport stack (TuiViewportedList,
TuiViewportIndex/Cursor, TuiScrollable, TuiText vertical scroll, and
mouse-wheel event conversion) plus an interactive warpui_core example
(tui_viewport_demo) that exercises every component over a simple
in-memory text-block index. No terminal/AI coupling.

Co-Authored-By: Oz <oz-agent@warp.dev>
@harryalbert harryalbert force-pushed the harry/tui-viewport-element branch from a2a99b5 to 9547813 Compare June 29, 2026 21:34
Comment thread crates/warpui_core/src/runtime/mod.rs Outdated
Comment thread crates/warpui_core/src/core/app/tui.rs Outdated
Comment thread crates/warpui_core/src/elements/tui/clipped.rs Outdated
Comment thread crates/warpui_core/src/elements/tui/clipped.rs Outdated
Comment thread crates/warpui_core/src/elements/tui/event.rs
Comment thread crates/warpui_core/src/elements/tui/viewported_list.rs Outdated
Comment thread crates/warpui_core/src/runtime/event_conversion.rs Outdated
Comment thread crates/warpui_core/src/runtime/event_conversion.rs Outdated
Comment thread crates/warpui_core/src/elements/tui/viewported_list.rs Outdated
Comment thread crates/warpui_core/src/elements/tui/viewported_list.rs Outdated
@harryalbert harryalbert force-pushed the harry/tui-viewport-element branch from d49da1b to 99c98bf Compare June 29, 2026 23:02
@harryalbert harryalbert requested a review from kevinyang372 June 30, 2026 13:58
Comment thread crates/warpui_core/src/elements/tui/viewported_list.rs Outdated
Comment thread crates/warpui_core/src/elements/tui/viewported_list.rs
Comment thread crates/warpui_core/src/runtime/mod.rs Outdated
Comment thread crates/warpui_core/src/elements/tui/clipped.rs Outdated
Comment thread crates/warpui_core/src/elements/tui/event.rs Outdated
@harryalbert harryalbert merged commit 358ba8e into master Jun 30, 2026
40 of 42 checks passed
@harryalbert harryalbert deleted the harry/tui-viewport-element branch June 30, 2026 18:15
dagmfactory pushed a commit that referenced this pull request Jun 30, 2026
## Description
<!-- Please remember to add your design buddy onto the PR for review, if
it contains any UI changes! -->

This PR adds a generalized viewport element that takes caller-owned
ordered-height index/cursor, and handles rendering only the visible rows
in an efficient way (and keeping scroll position stable through
resizes). This viewport will serve as the backing element to render the
blocklist, without being blocklist-specific (any other caller could
provide a sum tree and set of items and get the same efficient rendering
for free). This PR also adds some smaller helpers to allow for
generalized item clipping and scrollable behavior, and handling for
scroll mouse events.

The big things to read in this PR are:
* crates/warpui_core/src/elements/tui/viewported_list.rs
    * New generic virtualized list / viewport.
* crates/warpui_core/src/elements/tui/scrollable.rs
    * New wheel-scroll wrapper.
* crates/warpui_core/src/elements/tui/clipped.rs
    * New vertical row clipping wrapper.
* crates/warpui_core/src/runtime/event_conversion.rs
    * Adds crossterm mouse/wheel conversion into Warp’s shared Event.
* crates/warpui_core/src/elements/tui/event.rs
* Changes TUI event context from queued “app updates” to view
notifications.
* crates/warpui_core/examples/tui_viewport_demo.rs
    * Manual harness demonstrating the pieces together.

## Testing
<!--
How did you test this change? What automated tests did you add? If you
didn't add any new tests, what's your justification for not adding any?

Manual testing is required for changes that can be manually tested, and
almost all changes can be manually tested. If your change can be
manually tested, please include screenshots or a screen recording that
show it working end to end.

You can run the app locally using `./script/run` - see AGENTS.md for
more details on how to get set up.
-->

- [x] I have manually tested my changes locally with `./script/run`

### Screenshots / Videos
<!-- Attach screenshots or a short video demonstrating the change, where
appropriate. Remove this section if it is not relevant to your PR. -->

Running the demo added in this PR:
https://www.loom.com/share/dd626bbe4c2e470da975b44c5d80ab15

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

---------

Co-authored-by: Oz <oz-agent@warp.dev>
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