Skip to main content

ime_commit

Function ime_commit 

Source
pub fn ime_commit(
    value: &str,
    state: &TextEditState,
    text: &str,
    now: f32,
) -> (String, TextEditState)
Expand description

Finalize the composition: replace the provisional range with text as a REAL, undoable edit and clear ime_range/ime_origin. The recorded undo inverse restores ime_origin (the PRE-composition text) directly — one Cmd+Z removes the whole committed word, not just the last preedit snapshot (apply_and_record_with_inverse’s whole reason for existing). If there’s no active composition (a commit with no preceding preedit — some IMEs do this for single-candidate confirmations), replaces the current selection instead, same as a normal insert.