Repository navigation
release: v0.32.0 — IME contract (ADR-045) - #39
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changed (breaking)
IMEControllerinstead of versionedinterfaces; all text positions are UTF-8 byte offsets.
IMEController:SetIMEPosition(x, y int)is replaced bySetIMECursorArea(IMECursorArea)(logical DIP).New methods:
SetIMEContentType,SetIMESurroundingText,CancelIME,IMECapabilities. Every method mustbe safe from any goroutine.
IMEState:CursorPos,SelectionStartandSelectionEndare replaced byCursorandSelection(
IMETextRange). A{-1, -1}cursor means the IME hides it (HasCursor).IMECapabilitiesreports what the platform does. Consumers readstate.Cursor.Startwhere they readstate.CursorPos.Added
IMETextRange,IMESurroundingText,IMECursorArea,IMEDeleteSurroundingEvent, with UTF-8 validation thatnever clamps.
ContentPurpose(incl.Chat) and theContentHintbitset, with names from tables keyed by the constants.IMECapabilitiesin three groups, as in winit: cursor area, content type, surrounding text.IMEEventSource(OnIMECanceled,OnIMEDisabled,OnIMEDeleteSurrounding), found by type assertion.Documentation
WindowProvider.RequestRedrawmust be safe to call from any goroutine, and requests coalesce.Changed
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.