🐞 Preserve cycle progress across windows and overlapping keybinds - #1143
Merged
Conversation
mrkai77
force-pushed
the
kai/fix/multi-key-cycle-progress
branch
from
August 30, 2026 06:47
8e53c30 to
34b070f
Compare
mrkai77
force-pushed
the
kai/fix/multi-key-cycle-progress
branch
from
August 30, 2026 06:47
34b070f to
688b517
Compare
There was a problem hiding this comment.
🟡 Changes recommended
ResizeContext.commitWindowTarget currently clears cycle progress for the previous window on target changes, which undermines the stated goal of preserving independent per-window cycle progress.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors cycle/keybind handling so cycle progress is tracked per target window + parent cycle, and keybind matching is centralized to avoid interference from overlapping key sequences.
Changes:
- Introduces
CycleActionCoordinator+CycleProgressStoreto propose/commit cycle selections with stable per-window/per-cycle cursors. - Extracts keybind decision-making into
KeybindResolverand rewiresKeybindTriggerto use it. - Adds a new
LoopTestsunit test target with coverage for cycle progress and overlapping multi-key cycles.
File summaries
| File | Description |
|---|---|
| LoopTests/OverlappingKeybindCycleTests.swift | Adds regression tests for overlapping prefix/chord cycle advancement behavior. |
| LoopTests/KeybindResolverTests.swift | Adds unit tests for resolver handling (key up behavior, autorepeat suppression, trigger rules). |
| LoopTests/CycleProgressStoreTests.swift | Validates progress persistence, wrapping, reseeding, and independence across parent cycles/targets. |
| LoopTests/CycleActionCoordinatorTests.swift | Tests restart policy logic for interrupted cycles and key sequence origins. |
| Loop/Window Management/Window Manipulation/WindowRecords.swift | Extends resolved record snapshot to include currentAction for seeding cycles. |
| Loop/Window Management/Window Manipulation/ResizeContext.swift | Adds prepared/committed window target switching and integrates the cycle coordinator. |
| Loop/Window Management/Window Action/CycleProgressStore.swift | Implements per-window/per-cycle cursor storage keyed by IDs. |
| Loop/Window Management/Window Action/CycleActionCoordinator.swift | Encapsulates restart/seed logic and coordinates proposals + commits with stored progress. |
| Loop/Core/Observers/KeybindTrigger.swift | Refactors event handling to delegate matching/effects to KeybindResolver. |
| Loop/Core/Observers/Helpers/KeybindResolver.swift | New pure resolver that returns match/effect/handling decisions without mutating trigger state. |
| Loop/Core/LoopManager.swift | Integrates coordinated cycle proposal/commit and hardens async window-target updates with revision guards. |
| Loop.xcodeproj/xcshareddata/xcschemes/Loop.xcscheme | Updates scheme to include the new test bundle and a test-friendly build configuration. |
| Loop.xcodeproj/xcshareddata/xcschemes/Loop (GH ACTIONS).xcscheme | Updates CI scheme to run the new test bundle. |
| Loop.xcodeproj/project.pbxproj | Adds the LoopTests unit test target and build configurations. |
Review details
- Files reviewed: 14/14 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
🚧 Development Build Finished
|
6 tasks
Contributor
|
🚧 Development Build Finished
|
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.
Fixes cycle progression so each cycle keeps its own position for each target window. Previously, Loop inferred progress from the current resize action, which could cause cycles to interfere with one another. It also made multi-key cycles repeatedly select their first action when "Always start cycles from first item" was enabled and a shorter prefix was also bound.
Cycle selection now lives in a dedicated
CycleActionCoordinator, backed by aCycleProgressStorekeyed by the target window and parent cycle. The coordinator handles restart behavior, overlapping key sequences, and selecting/committing actions, while the store keeps progress stable using child action IDs.This also extracts keybind matching into
KeybindResolverand adds aLoopTeststarget covering cycle progress, keybind handling, and overlapping multi-key cycles :)