Skip to content

feat(flterm): normalize layout-aware keyboard input - #104

Open
adonm wants to merge 1 commit into
elias8:mainfrom
adonm:upstream/70-layout-keyboard
Open

feat(flterm): normalize layout-aware keyboard input#104
adonm wants to merge 1 commit into
elias8:mainfrom
adonm:upstream/70-layout-keyboard

Conversation

@adonm

@adonm adonm commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • normalize physical key, action, text, consumed modifiers, lock/side state, composition state, and active-layout unshifted codepoint before terminal encoding
  • add Linux, macOS, and Windows native metadata companions with a documented Flutter fallback for mobile/web
  • keep dead keys and IME preedit on the text-input path and suppress paired release leakage
  • add side-aware macOS TerminalConfig.optionAsAlt

Why

Flutter's public KeyEvent does not expose consumed modifiers or the active layout's unmodified translation. Capturing platform metadata before framework normalization keeps platform translation separate from terminal protocol encoding and covers non-US layouts, AltGr/Option, dead keys, lock state, repeats, and releases.

July 2026 update: reworked onto current main

Rebased after #143/#144 and reworked for the controller/view input pipeline:

  • KeyboardInputAdapter now normalizes through KeyboardEventNormalizer; the previous controller-internal encoder path is gone.
  • Upstream's unshifted static map, consumed-modifier fallback, and IME routing now feed through the normalizer, so the native companions only override where they have real metadata.
  • Virtual-modifier exclusion and the consumed-ctrl strip are preserved when terminal mods are assembled.
  • TerminalConfig.optionAsAlt uses the libghostty OptionAsAlt config enum; TerminalController accepts an optional keyEventNormalizer.

Verification

  • Flterm suite with source-compiled native assets (Zig 0.16): 983 passed, including normalizer, metadata-store, keyboard-event, platform-map, and config tests.
  • dart format and dart analyze clean (only 2 pre-existing info lints under tool/benchmarks).
  • Native companions compile/register for Linux (GTK), macOS (Swift), and Windows (C API).

Closes #70.

Port the layout-aware keyboard metadata companions onto the controller/
view input pipeline.

- normalize physical key, action, text, consumed modifiers, lock/side
  state, composition state, and active-layout unshifted codepoint before
  terminal encoding
- add Linux, macOS, and Windows native metadata companions with a
  documented Flutter fallback for mobile/web
- keep dead keys and IME preedit on the text-input path and suppress
  paired release leakage
- add side-aware macOS TerminalConfig.optionAsAlt
- keep the existing virtual-modifier exclusion and consumed-ctrl strip
  when terminal mods are assembled

The previous implementation was carried downstream in the Zuko
remote-shell client; this rework targets the refactored input pipeline.
@adonm
adonm force-pushed the upstream/70-layout-keyboard branch from 4b7f138 to ff72254 Compare August 26, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(flterm): support layout-aware terminal keyboard input

1 participant