Repository navigation
Navigation components and testing utilities - #84
Merged
Merged
Conversation
Consolidate the fuzzy scoring logic previously duplicated inline in list and dropdown components into src/core/fuzzy.zig. Adds matchPositions for highlighting and a rank helper, exposed via zz.fuzzy.
Single-line bar with left/center/right segment groups, each with independent styling. Useful as a footer for editor-style apps and dashboards. Exposed via zz.StatusBar.
Horizontal path navigation with styled segments, custom separator, and middle-ellipsis truncation when max_width is set. Highlights the final segment as the active location. Exposed via zz.Breadcrumb.
Multi-step progress indicator with completed/current/pending states, horizontal or vertical orientation, and keyboard navigation. Useful for wizard-style flows. Exposed via zz.Stepper.
Two-pane container with orientation, draggable divider (via growA/growB or arrow keys), min-size clamping, and string composition helper. Caller renders each pane using the sizes returned by dims(). Exposed via zz.SplitPane.
Fuzzy-filtered command launcher with prompt, placeholder, description and shortcut columns, arrow-key navigation, and escape/enter semantics returned via KeyResult. Pairs with the new fuzzy matcher utility.
expectSnapshot compares rendered output against a golden file and writes the snapshot when missing. ANSI-aware: by default strips escape codes and trailing whitespace for stable goldens. Set ZIGZAG_UPDATE_SNAPSHOTS=1 to regenerate existing snapshots. Exposed via zz.testing.
Recorder captures timestamped key events to a line-based text format; Player parses them back for deterministic replay of demos and bug reports. Supports modifiers, character codepoints, and escaped paste strings. Exposed via zz.testing.Recorder and zz.testing.Player.
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.
Summary
Adds five new components for navigation/layout and two testing utilities, plus a refactor consolidating duplicated fuzzy-match logic.
New components
zz.StatusBar) — single-line bar with left/center/right segment groups, each independently styledzz.Breadcrumb) — horizontal path navigation with active-segment highlight and middle-ellipsis truncation whenmax_widthis setzz.Stepper) — wizard-style progress indicator with completed/current/pending states, horizontal or vertical orientation, and keyboard navigationzz.SplitPane) — two-pane container with a draggable divider, min-size clamping, and acompose()helper that places two pre-rendered pane strings side-by-side (or stacked) with a styled divider between themzz.CommandPalette) — fuzzy-filtered launcher modeled on VS Code's Ctrl-P, with prompt, placeholder, description and shortcut columns, andKeyResult(accepted/cancelled/consumed/ignored) returned fromhandleKeyTesting utilities (
zz.testing)expectSnapshot) — golden-file assertions with automatic first-run creation, ANSI-stripped normalization by default, and regeneration viaZIGZAG_UPDATE_SNAPSHOTS=1Recorder,Player) — captures timestamped key events to a line-based text format and parses them back, so demos and bug reports can be reproduced deterministicallyRefactor
src/core/fuzzy.zig(exposed aszz.fuzzy). Previously duplicated inline inlist.ziganddropdown.zig. AddsmatchPositionsfor highlighting matched characters and arankhelper for sorted results.Test plan
zig buildpasses with no warningszig build test— 400+ tests pass, including new tests for every added moduleStatusBar,Breadcrumb,Stepper,SplitPane,CommandPalettein a terminal (showcase integration in a follow-up)ZIGZAG_UPDATE_SNAPSHOTS=1regenerates snapshots on a real componentRecorder, replay it throughPlayer, confirm key-by-key equivalence