-
Notifications
You must be signed in to change notification settings - Fork 366
Description
Describe the bug
When a .tape file generates enough output to cause the terminal to scroll, the Wait+Screen /regex/ command fails to find text that is printed/currently visible on the screen.
It appears that instead of searching the visible lines on the screen, the command searches the lines at the top of the terminal's scrollback buffer. This makes it impossible to use Wait+Screen to match new command output once a terminal has scrolled.
This issue is related to #657. and likely stems from the VHS.Buffer method, which appears to not account for the scroll position.
Setup
- OS: macOS (15.6.1)
- Shell:
zsh,bash,nu
To Reproduce
-
Create a file named
wait-screen-test.tapewith the following content.Set Height 300 Type "seq 10" Enter Wait+Screen /9/ Type "echo foo" Enter -
Run the tape file:
vhs wait-screen-test.tape.
Actual Behavior
The vhs command execution halts and exits with a timeout error because the regex only matches against output in the beginning of the terminal buffer.
% vhs wait-screen-test.tape
File: wait-screen-test.tape
Set Height 300
Type seq 10
Enter 1
Wait Screen 9
failed to execute command: timeout waiting for "Screen 9" to match 9; last value was: > seq 10
1
2
3
4
5
recording failed
Expected Behavior
The Wait+Screen command should match the regex by searching the terminal buffer visible on the screen. The tape execution should then continue.
% vhs wait-screen-test.tape
File: wait-screen-test.tape
Set Height 300
Type seq 10
Enter 1
Wait Screen 9
Type echo foo
Enter 1