Vixen
dd8b0a81

TextCompositionEvent

class Core/Vixen.Ui/Keyboard.cs:140
csharp
public sealed class TextCompositionEvent

Text an input method is still composing, which is not yet text the user typed.

Read the guide page for this →

Remarks

⚠ The separate event is the whole design, and folding it into TextInputEvent is how an interface becomes unusable in Japanese without anybody noticing. A composition is provisional: it is replaced in place on every keystroke, may be abandoned entirely, and is only real when a TextInputEvent arrives carrying the committed string. A control that inserted each pre-edit as typed text ends up with every intermediate reading of every word in the field, and a control that ignored the event shows nothing at all while the user types — the field looks broken and the candidate window floats over a blank box.

⚠ An empty Text is a cancellation and not "nothing happened". Every platform ends an abandoned composition by sending one, and a handler that returns early on an empty string leaves the last pre-edit on screen for ever.

Start and Length are the input method's own cursor within the pre-edit, which is what puts the caret in the middle of a half-converted phrase where the IME thinks it is rather than at the end of it.

Fields and properties (4)

  • public string Text

    The pre-edit string, or empty to abandon the composition.

  • public int Start

    Where the input method's own cursor sits inside Text.

  • public int Length

    How much of Text that cursor has selected.

  • public TimeSpan Timestamp

    When, on the same clock as the rest.

Used by (9)

  • AdvancedFixtureVixen.Ui.Controls.Advanced.Tests
  • CodeEditorVixen.Ui.Controls.Advanced
  • ControlFixtureVixen.Ui.Controls.Tests
  • PlatformInputVixen.Platform.Ui
  • TextCompositionRoutingTestsVixen.Platform.Ui.Tests
  • TextFieldVixen.Ui.Controls
  • TextWindowRoutingTestsVixen.Platform.Ui.Tests
  • UiDocumentVixen.Ui
  • UiTestVixen.Ui.Testing