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.\n\nThis work item will: \n- 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.\n- 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.\n\nAcceptance criteria:\n- ChordHandler.feed preserves deferred handlers when deduping duplicate events.\n- New unit test in test/tui-chords.test.ts reproduces the issue and passes.\n- All existing tests continue to pass.\n\nNotes:\n- Priority: medium.\n- Issue discovered during PR review of PR #930 (TUI freeze fixes).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions