Skip to content

Preserve deferred chord handler when deduping duplicate key events (ChordHandler) #957

@SorraTheOrc

Description

@SorraTheOrc

When duplicate physical key events arrive while a chord pending-timer is active, the ChordHandler.feed() flow clears the existing timer and also clears pendingHandler. The duplicate dedupe branch then reschedules a timer but pendingHandler is null, which causes the deferred handler to be lost and never invoked.

This work item will:

  • Update src/tui/chords.ts so clearing an existing timer does not drop a previously set pendingHandler; preserve/restore the handler across the dedupe path.
  • Add a unit test to cover the scenario: a deferred single-key handler is pending, a duplicate physical event arrives, and after the timeout the deferred handler is invoked.

Acceptance criteria:

  • ChordHandler.feed preserves deferred handlers when deduping duplicate events.
  • New unit test in test/tui-chords.test.ts reproduces the issue and passes.
  • All existing tests continue to pass.

Notes:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions