forked from charmbracelet/vhs
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Summary
The Wait+Screen command fails to match text that appears on screen after terminal scrolling. It searches the top of the scrollback buffer instead of the currently visible viewport.
Bug Details
Symptom
Type "vm0 cook start"
Enter
Wait+Screen@120s /Run completed successfully/
# Times out even though text is visible on screen
Error message:
timeout waiting for "Screen Run completed successfully" to match Run completed successfully;
last value was: [shows old content from top of buffer, not current screen]
Root Cause
The VHS.Buffer() method in vhs.go does not account for scroll position. When terminal output causes scrolling, it continues reading from the top of the scrollback buffer instead of the visible viewport.
Upstream References
| Resource | URL |
|---|---|
| Bug Report | charmbracelet#659 |
| Proposed Fix | charmbracelet#658 |
| Related Issue | charmbracelet#657 |
Key Files to Investigate
vhs.go- ContainsBuffer()method that needs fixingcommand.go- Wait command implementation, callsBuffer()
PR charmbracelet#658 Fix Approach
The PR title: "fix: capture visible viewport in VHS.Buffer"
The fix should modify Buffer() to:
- Get current scroll position
- Calculate visible viewport based on terminal rows
- Return content from visible area, not scrollback top
Test Case
Create test.tape:
Output test.gif
Set Shell bash
Set FontSize 16
Set Width 800
Set Height 600
# Generate scrolling output
Type "for i in {1..50}; do echo Line $i; done"
Enter
Sleep 2s
# This should match "Line 50" visible on screen
Wait+Screen@10s /Line 50/
Type "echo done"
Enter
Sleep 1s
Expected: Should find "Line 50" on visible screen
Actual: Times out because it searches top of buffer (Line 1, 2, 3...)
Success Criteria
Wait+Screenmatches text visible after scrolling- Existing tests pass
- No regression in
Waitwithout+Screenmodifier
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels