Package limn.scene.event
Class PreeditEvent
java.lang.Object
limn.scene.event.InputEvent
limn.scene.event.PreeditEvent
In-progress IME composition ("preedit"): the text an input method is still
composing, shown inline with an underline but not committed to the
editing model. The committed result arrives later as ordinary
CharEvents; preedit is purely the transient overlay shown while the
user is composing (e.g. typing romaji/pinyin before picking a candidate).
An empty event clears the composition (the user committed or cancelled it). Routed to the focused widget only; a preedit with nothing focused is dropped.
Part of the composing text may be the target: the stretch the input method is
converting now, which the user picks a candidate for, drawn differently from the rest.
targetStart() and targetLength() say where it is. Every index carried here
(caret, the target) is in code points, matching the platform IME.
-
Constructor Summary
ConstructorsConstructorDescriptionPreeditEvent(@Nullable String text, int caret, int targetStart, int targetLength) An IME composition update. -
Method Summary
Modifier and TypeMethodDescriptionintcaret()Caret position withintext(), in code points.booleanisEmpty()intHow long the stretch being converted is, in code points;0when there is none.intWhere the stretch being converted starts withintext(), in code points.text()The composing text; empty when the composition ends (commit or cancel).toString()Methods inherited from class limn.scene.event.InputEvent
consume, isConsumed
-
Constructor Details
-
PreeditEvent
An IME composition update. Empty text ends the composition.- Parameters:
text- the composing text;nullis emptycaret- caret position withintext, in code pointstargetStart- where the stretch being converted starts, in code pointstargetLength- its length in code points;0when nothing is being converted
-
-
Method Details
-
text
The composing text; empty when the composition ends (commit or cancel). -
targetStart
public int targetStart()Where the stretch being converted starts withintext(), in code points. -
targetLength
public int targetLength()How long the stretch being converted is, in code points;0when there is none. -
caret
public int caret()Caret position withintext(), in code points. -
isEmpty
public boolean isEmpty()- Returns:
- whether the composition is empty (i.e. this event clears the preedit)
-
toString
-