K3InputMethod

abstract class K3InputMethod<S : K3InputMethodState<S, E>, E : K3Editor, U : K3InputMethod.UpdateStateScope<S, E>>(initialState: S)(source)

The input method is the main class of the k3lp runtime, which manages the input method state and which provides thread-safe state update mechanisms.

Parameters

initialState

The initial input method state.

Inheritors

Constructors

Link copied to clipboard
constructor(initialState: S)

Types

Link copied to clipboard
abstract class UpdateStateScope<S : K3InputMethodState<S, E>, E : K3Editor>(var state: S)

Properties

Link copied to clipboard
val activeState: StateFlow<S>

The currently active input method state as a state flow.

Functions

Link copied to clipboard
inline suspend fun updateState(function: suspend U.() -> Unit)

Allows to update the state of this input method and to perform side effects on the current editor.

Link copied to clipboard
abstract fun updateStateScopeOf(state: S): U

Creates an UpdateStateScope object with given state and returns it.