Skip to content

Conversation

runesoerensen
Copy link

@runesoerensen runesoerensen commented Aug 23, 2025

Describe your changes

The VHS.Buffer method was incorrectly reading from the top of the scrollback buffer.

This causes issues when using the Wait+Screen /regex/ command, and when writing output to golden files.

The logic now accounts for the scroll position (viewportY) to capture visible lines in the terminal viewport as expected.

More details in the issues linked below (which both include the output after this change in the "Expected Behavior" sections, as well as steps to reproduce the current unexpected behavior).

Additional Style Changes

  • Prefer blank identifier for unused variable.
  • Replaced fill().map() with Array.from() for clarity.
  • Renamed the method CurrentLines and updated comments for clarity and accuracy.

Related issue/discussion

Closes #657, closes #659

Checklist before requesting a review

@runesoerensen runesoerensen requested a review from a team as a code owner August 23, 2025 09:12
@runesoerensen runesoerensen requested review from meowgorithm and andreynering and removed request for a team August 23, 2025 09:12
The `VHS.Buffer` method was incorrectly reading from the top of the scrollback buffer. It now accounts for the scroll position (`viewportY`) to accurately capture the visible terminal viewport
@runesoerensen runesoerensen changed the title Correct VHS.Buffer to capture visible viewport fix: correct VHS.Buffer to capture visible viewport Aug 23, 2025
@runesoerensen runesoerensen changed the title fix: correct VHS.Buffer to capture visible viewport fix: capture visible viewport in VHS.Buffer Aug 23, 2025
The new name more accurately describes that the method returns only the lines currently visible in the terminal's viewport, improving clarity and consistency with the related `CurrentLine` method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wait+Screen regex fails to match text in the viewport after scrolling Testing output doesn't capture the viewport when the terminal content scrolls
1 participant