keystrokesEqual function

bool keystrokesEqual(
  1. ParsedKeystroke a,
  2. ParsedKeystroke b
)

Compare two ParsedKeystrokes for equality. Collapses alt/meta into one logical modifier — legacy terminals cannot distinguish them, so "alt+k" and "meta+k" are the same key. Super (cmd/win) is distinct — only arrives via kitty keyboard protocol.

Implementation

bool keystrokesEqual(ParsedKeystroke a, ParsedKeystroke b) {
  return a.key == b.key &&
      a.ctrl == b.ctrl &&
      a.shift == b.shift &&
      (a.alt || a.meta) == (b.alt || b.meta) &&
      a.superKey == b.superKey;
}