Merged
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Test and refactor `core` module
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prepares the v0.12.0 release by refactoring the rendering pipeline from “panes” to keyed StyledGraphemes, and by introducing a terminal harness plus zsh parity scenarios/tests to validate wrap/scroll/resize behavior.
Changes:
- Replace
Pane/PaneFactorywithStyledGraphemes/Widget, and update presets/widgets/core renderer accordingly. - Add
termharness,zsherio, andzsh-render-paritycrates to drive scenario-based parity testing against real zsh. - Update workspace membership/dependencies, docs, examples, CI, and VHS tapes/scripts for the new structure.
Reviewed changes
Copilot reviewed 63 out of 64 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
Cargo.toml |
Adds new workspace members and workspace deps (e.g. portable-pty, thiserror). |
.github/workflows/ci.yml |
Installs zsh on CI before running tests. |
.gitignore |
Ignores zsh parity test artifacts output directory. |
README.md |
Updates version to 0.12.0 and refreshes docs/commands/links. |
Concept.md |
Rewrites architecture docs to match the new grapheme-based rendering model and new test tooling. |
scripts/render_tapes_gif.sh |
Adds a helper script to render all .tape files via vhs. |
tapes/tree.tape |
Updates demo command to run a binary instead of an example. |
tapes/readline.tape |
Updates demo command to run a binary instead of an example. |
tapes/query_selector.tape |
Updates demo command to run a binary instead of an example. |
tapes/password.tape |
Updates demo command to run a binary instead of an example. |
tapes/listbox.tape |
Updates demo command to run a binary instead of an example. |
tapes/json.tape |
Updates demo command/args for the JSON binary. |
tapes/form.tape |
Updates demo command to run a binary instead of an example. |
tapes/confirm.tape |
Updates demo command to run a binary instead of an example. |
tapes/checkbox.tape |
Updates demo command to run a binary instead of an example. |
tapes/text.tape |
Adds a new VHS tape for the text binary. |
promkit/Cargo.toml |
Bumps promkit to 0.12.0, updates feature wiring, and bumps promkit-widgets dependency to 0.4.0. |
promkit/src/lib.rs |
Modifies the core event loop (notably around resize events). |
promkit/src/preset/tree.rs |
Migrates preset rendering from panes to StyledGraphemes via Widget. |
promkit/src/preset/text.rs |
Migrates preset rendering from panes to StyledGraphemes via Widget. |
promkit/src/preset/readline.rs |
Migrates preset rendering from panes to StyledGraphemes via Widget. |
promkit/src/preset/query_selector.rs |
Migrates preset rendering from panes to StyledGraphemes via Widget. |
promkit/src/preset/listbox.rs |
Migrates preset rendering from panes to StyledGraphemes via Widget. |
promkit/src/preset/json.rs |
Migrates preset rendering from panes to StyledGraphemes via Widget. |
promkit/src/preset/form.rs |
Migrates preset rendering from panes to StyledGraphemes via Widget. |
promkit/src/preset/checkbox.rs |
Migrates preset rendering from panes to StyledGraphemes via Widget. |
promkit-core/Cargo.toml |
Bumps promkit-core to 0.3.0. |
promkit-core/src/lib.rs |
Replaces PaneFactory with the new Widget trait API. |
promkit-core/src/render.rs |
Refactors renderer storage/update to keyed StyledGraphemes and renames constructor to try_new_with_graphemes. |
promkit-core/src/terminal.rs |
Refactors drawing logic to wrap/draw StyledGraphemes rows instead of panes. |
promkit-core/src/grapheme.rs |
Adds from_lines and wrapped_lines; removes Deref in favor of explicit methods; updates tests. |
promkit-core/src/pane.rs |
Removes the old Pane abstraction entirely. |
promkit-widgets/Cargo.toml |
Bumps promkit-widgets to 0.4.0 and changes default features behavior. |
promkit-widgets/src/tree.rs |
Migrates tree widget from PaneFactory to Widget and returns StyledGraphemes. |
promkit-widgets/src/text.rs |
Migrates text widget from PaneFactory to Widget and returns StyledGraphemes. |
promkit-widgets/src/listbox.rs |
Migrates listbox widget from PaneFactory to Widget and returns StyledGraphemes. |
promkit-widgets/src/checkbox.rs |
Migrates checkbox widget from PaneFactory to Widget and returns StyledGraphemes. |
promkit-widgets/src/jsonstream.rs |
Migrates jsonstream widget from PaneFactory to Widget and returns StyledGraphemes. |
promkit-widgets/src/text_editor.rs |
Migrates text editor widget from PaneFactory to Widget and updates wrapping/slicing logic. |
promkit-widgets/src/spinner.rs |
Updates spinner rendering to update renderer with StyledGraphemes instead of Pane. |
termharness/Cargo.toml |
Adds a new crate for PTY + alacritty-terminal based session/screen simulation. |
termharness/src/lib.rs |
Exposes session and terminal modules. |
termharness/src/terminal.rs |
Introduces TerminalSize type used by the harness. |
termharness/src/session.rs |
Implements PTY-backed session with screen parsing, DSR handling, resizing, and tests. |
zsherio/Cargo.toml |
Adds a new crate for zsh scenario definitions and helpers. |
zsherio/src/lib.rs |
Exposes scenario/session/opts modules and re-exports scenario types. |
zsherio/src/session.rs |
Adds helpers to spawn a generic session or a zsh session. |
zsherio/src/opts.rs |
Adds helpers to write bytes and send cursor/screen control sequences. |
zsherio/src/scenario.rs |
Adds a scenario runner + formatted screen snapshot recording and tests. |
zsherio/src/scenarios.rs |
Adds concrete scenarios used for parity testing (wrap/scroll/resize/etc.). |
zsherio/examples/zsh_middle_insert_wrap.rs |
Adds an example program to run a scenario against real zsh and print snapshots. |
zsh-render-parity/Cargo.toml |
Adds a new crate with a zsh-pretend binary and integration tests comparing to real zsh. |
zsh-render-parity/src/main.rs |
Implements a zsh-pretend loop using promkit Readline. |
zsh-render-parity/tests/common/mod.rs |
Adds shared helpers to wait for prompt, compare runs, and write artifacts. |
zsh-render-parity/tests/mid_buffer_insert_wrap.rs |
Adds parity test for mid-buffer insert wrap behavior. |
zsh-render-parity/tests/prompt_initial_render_at_mid_screen.rs |
Adds parity test for initial prompt render mid-screen. |
zsh-render-parity/tests/resize_roundtrip_wrap_reflow.rs |
Adds (ignored) parity test for aggressive resize wrap/reflow. |
zsh-render-parity/tests/tiny_viewport_overflow_wrap_scroll.rs |
Adds parity test for tiny-viewport overflow wrap/scroll behavior. |
examples/byop/Cargo.toml |
Enables required promkit features (readline, spinner) after feature refactor. |
examples/byop/src/byop.rs |
Updates BYOP example to new Widget/StyledGraphemes renderer API. |
examples/tree/src/tree.rs |
Updates tree example root path selection. |
examples/json/src/json.rs |
Simplifies JSON example by removing CLI title arg and hardcoding a title. |
event-dbg/src/main.rs |
Removes the old event-dbg tool. |
event-dbg/README.md |
Removes the old event-dbg README. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+24
to
25
| if height < viewable_rows.len() as u16 { | ||
| return Err(anyhow::anyhow!("Insufficient space to display all panes")); |
| // NOTE: For zsh_pretend/tests/resize_roundtrip_wrap_reflow.rs, skipping | ||
| // resize events here | ||
| // keeps output closer to zsh than evaluating resize as a normal input event. | ||
| if event.is_resize() { |
Comment on lines
+17
to
+22
| #[test] | ||
| fn zsh_pretend_parity_mid_buffer_insert_wrap() -> anyhow::Result<()> { | ||
| let expected = run_zsh()?; | ||
| let actual = run_zsh_pretend()?; | ||
|
|
||
| write_scenario_run_artifact(&expected)?; |
Comment on lines
+16
to
+19
| #[test] | ||
| fn zsh_pretend_parity_prompt_initial_render_at_mid_screen() -> anyhow::Result<()> { | ||
| let expected = run_zsh()?; | ||
| let actual = run_zsh_pretend()?; |
Comment on lines
+17
to
+22
| #[test] | ||
| fn zsh_pretend_parity_tiny_viewport_overflow_wrap_scroll() -> anyhow::Result<()> { | ||
| let expected = run_zsh()?; | ||
| let actual = run_zsh_pretend()?; | ||
|
|
||
| write_scenario_run_artifact(&expected)?; |
Comment on lines
+38
to
+43
| for (pane_index, rows) in viewable_rows.iter().enumerate() { | ||
| let max_rows = 1 | ||
| .max((height as usize).saturating_sub(used + viewable_rows.len() - 1 - pane_index)); | ||
| let rows = rows.iter().take(max_rows).collect::<Vec<_>>(); | ||
| let row_count = rows.len(); | ||
| used += row_count; |
|
|
||
| ```bash | ||
| cargo run --manifest-path examples/query_selector/Cargo.toml | ||
| cargo run --bin query_selector |
Comment on lines
+18
to
+20
| let mut cmd = CommandBuilder::new("/bin/zsh"); | ||
| cmd.arg("-fi"); | ||
| cmd.env("PS1", "❯❯ "); |
Comment on lines
+17
to
+23
| #[test] | ||
| #[ignore = "timing-sensitive and currently unsupported: matching zsh under aggressive \ | ||
| resize-wrap is too hard right now; run manually with `cargo test --release --test \ | ||
| resize_roundtrip_wrap_reflow`"] | ||
| fn zsh_pretend_parity_resize_roundtrip_wrap_reflow() -> anyhow::Result<()> { | ||
| let expected = run_zsh()?; | ||
| let actual = run_zsh_pretend()?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.