# `Plushie.Event.ImeEvent`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.6.0/lib/plushie/event/ime_event.ex#L1)

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 `:closed`
  * `text` - composition text (preedit) or final committed string (commit)
  * `cursor` - `{start, end}` byte offsets within the preedit text
  * `captured` - 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

# `t`

```elixir
@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
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
