Skip to content

🐞 Preserve cycle progress across windows and overlapping keybinds - #1143

Merged
mrkai77 merged 7 commits into
developfrom
kai/fix/multi-key-cycle-progress
Aug 31, 2026
Merged

🐞 Preserve cycle progress across windows and overlapping keybinds#1143
mrkai77 merged 7 commits into
developfrom
kai/fix/multi-key-cycle-progress

Conversation

@mrkai77

@mrkai77 mrkai77 commented Aug 30, 2026

Copy link
Copy Markdown
Owner

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 a CycleProgressStore keyed 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 KeybindResolver and adds a LoopTests target covering cycle progress, keybind handling, and overlapping multi-key cycles :)

@mrkai77
mrkai77 force-pushed the kai/fix/multi-key-cycle-progress branch from 8e53c30 to 34b070f Compare August 30, 2026 06:47
@mrkai77
mrkai77 force-pushed the kai/fix/multi-key-cycle-progress branch from 34b070f to 688b517 Compare August 30, 2026 06:47
@mrkai77
mrkai77 requested a lite review from Copilot August 30, 2026 06:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 + CycleProgressStore to propose/commit cycle selections with stable per-window/per-cycle cursors.
  • Extracts keybind decision-making into KeybindResolver and rewires KeybindTrigger to use it.
  • Adds a new LoopTests unit 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.

Comment thread Loop/Window Management/Window Manipulation/ResizeContext.swift Outdated
@github-actions

Copy link
Copy Markdown
Contributor

🚧 Development Build Finished

@mrkai77 mrkai77 self-assigned this Aug 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚧 Development Build Finished

@mrkai77
mrkai77 merged commit ebfe9ba into develop Aug 31, 2026
1 check passed
@mrkai77
mrkai77 deleted the kai/fix/multi-key-cycle-progress branch August 31, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 Two-key cycles do not advance when both action keys are released between presses

2 participants