Skip to content

release: v0.32.0 — IME contract (ADR-045) - #39

Merged
kolkov merged 3 commits into
mainfrom
feat/P1-IME-001-ime-contract
Nov 8, 2026
Merged

kolkov merged 3 commits into
mainfrom
feat/P1-IME-001-ime-contract

Conversation

@kolkov

@kolkov kolkov commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Changed (breaking)

  • IME contract (ADR-045), based on gpucontext#30 by @besmpl. One extended IMEController instead of versioned
    interfaces; all text positions are UTF-8 byte offsets.
    • IMEController: SetIMEPosition(x, y int) is replaced by SetIMECursorArea(IMECursorArea) (logical DIP).
      New methods: SetIMEContentType, SetIMESurroundingText, CancelIME, IMECapabilities. Every method must
      be safe from any goroutine.
    • IMEState: CursorPos, SelectionStart and SelectionEnd are replaced by Cursor and Selection
      (IMETextRange). A {-1, -1} cursor means the IME hides it (HasCursor).
    • Migration: hosts implement the new methods. Methods for unsupported operations are no-ops, and
      IMECapabilities reports what the platform does. Consumers read state.Cursor.Start where they read
      state.CursorPos.

Added

  • IMETextRange, IMESurroundingText, IMECursorArea, IMEDeleteSurroundingEvent, with UTF-8 validation that
    never clamps.
  • ContentPurpose (incl. Chat) and the ContentHint bitset, with names from tables keyed by the constants.
  • IMECapabilities in three groups, as in winit: cursor area, content type, surrounding text.
  • Optional IMEEventSource (OnIMECanceled, OnIMEDisabled, OnIMEDeleteSurrounding), found by type assertion.

Documentation

  • WindowProvider.RequestRedraw must be safe to call from any goroutine, and requests coalesce.
  • Package doc, AGENTS.md and ROADMAP list the IME interfaces.

Changed

  • deps: gputypes v0.8.0 → v0.8.2

Supersedes #30: the contract follows ADR-045 (one extended IMEController, no versioned interfaces), and the range types, enums, delete-surrounding event and tests come from @besmpl's work there, with co-author credit.

kolkov and others added 3 commits November 8, 2026 15:01
Replaces IMEController and IMEState in place instead of adding versioned
interfaces next to them (ADR-045 Option A, pre-v1.0):

- IMEController: SetIMEPosition is replaced by SetIMECursorArea (logical
  DIP); new SetIMEContentType, SetIMESurroundingText, CancelIME and
  IMECapabilities; every method safe from any goroutine.
- IMEState: Cursor and Selection as UTF-8 byte ranges (IMETextRange);
  a {-1, -1} cursor means hidden.
- IMECapabilities in winit's three groups; optional IMEEventSource
  (canceled, disabled, delete-surrounding) found by type assertion.
- ContentPurpose and ContentHint with names from tables keyed by the
  constants, and tests that fail when a constant has no name.

Based on gpucontext#30: the text range, surrounding text, cursor area,
purpose/hint enums, delete-surrounding event and their tests come from it.

Co-authored-by: Mark <besmpl@icloud.com>
ui's animation driver calls it from its own goroutine, and gogpu documents
its implementation as safe; the interface now says so for every host
(gpucontext P2-DOC-001).
CHANGELOG section, ROADMAP current version (was still v0.31.2), AGENTS.md
and the package doc list the IME interfaces; gputypes v0.8.0 -> v0.8.2.
@codecov

codecov Bot commented Nov 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kolkov
kolkov merged commit 5566483 into main Nov 8, 2026
10 checks passed
@kolkov
kolkov deleted the feat/P1-IME-001-ime-contract branch November 8, 2026 12:08
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.

1 participant