ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function formatBinding

    • Formats a key-binding string into a human-readable label for display in the help modal. Uses platform-appropriate symbols (⌘ ⌥ ⌃ ⇧) on macOS and spelled-out names (Ctrl, Alt, Shift) elsewhere.

      Parameters

      • binding: KeyBinding

        The key-binding source (same shape as in config).

      Returns string

      A pretty label such as "⌘⇧R" or "Ctrl+Shift+R".

      formatBinding("mod+shift+r"); // "⌘⇧R" on macOS, "Ctrl+Shift+R" on other
      formatBinding("shift+?"); // "⇧?" on macOS, "Shift+?" on other
      export function formatBinding(binding: KeyBinding): string {
      const tokens = formatBindingTokens(binding);
      return isMac() ? tokens.join("") : tokens.join("+");
      }