Input Method Editor events from subscriptions.
IME events are emitted during CJK and other complex text input. The
lifecycle is: :opened -> one or more :preedit -> :commit -> :closed.
Fields
type-:opened,:preedit,:commit, or:closedtext- composition text (preedit) or final committed string (commit)cursor-{start, end}byte offsets within the preedit textcaptured- whether a subscription captured this event
Pattern matching
def update(model, %ImeEvent{type: :preedit, text: text, cursor: {start, _end}}) do
show_composition(model, text, start)
end
def update(model, %ImeEvent{type: :commit, text: text}) do
insert_text(model, text)
end
Summary
Types
@type t() :: %Plushie.Event.ImeEvent{ captured: boolean(), cursor: {non_neg_integer(), non_neg_integer()} | nil, id: String.t() | nil, scope: [String.t()], text: String.t() | nil, type: :opened | :preedit | :commit | :closed, window_id: String.t() | nil }