feat: include cursor position in wait change detection#4
Open
feat: include cursor position in wait change detection#4
Conversation
hasChanged now compares cursor x/y in addition to screen text, title, and fullscreen state. This allows `wait` to resolve when only the cursor moves (e.g. vim navigating without changing text), giving agents more accurate readiness signals without polling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Problem
wait tracked changes in screen text, title, and fullscreen state — but not cursor position. When a program moved the cursor without changing visible text (e.g. vim navigating between lines, pdb repositioning the prompt, or any TUI app
that redraws the cursor after processing input), wait would not resolve. Agents had to fall back to blind sleep calls to compensate.
This is particularly relevant now that wait is being positioned as a semantic readiness signal rather than a polling mechanism — cursor stability is a key indicator that a program has finished responding to input.
Solution
Extended hasChanged to also compare cursor x/y position. wait now captures the cursor position before waiting and compares it on each change event. If only the cursor moves (screen text unchanged), wait still resolves correctly.
Changes
Tests
Four new unit tests on hasChanged: