pub enum Event {
Opened,
Preedit(String, Option<Range<usize>>),
Commit(String),
Closed,
}
Expand description
Describes input method events.
This is also called a “composition event”.
Most keypresses using a latin-like keyboard layout simply generate a
keyboard::Event::KeyPressed
.
However, one couldn’t possibly have a key for every single
unicode character that the user might want to type. The solution operating systems employ is
to allow the user to type these using a sequence of keypresses instead.
Variants§
Opened
Notifies when the IME was opened.
After getting this event you could receive Preedit
and
Commit
events. You should also start performing IME related requests
like Shell::request_input_method
.
Preedit(String, Option<Range<usize>>)
Notifies when a new composing text should be set at the cursor position.
The value represents a pair of the preedit string and the cursor begin position and end
position. When it’s None
, the cursor should be hidden. When String
is an empty string
this indicates that preedit was cleared.
The cursor range is byte-wise indexed.
Commit(String)
Notifies when text should be inserted into the editor widget.
Right before this event, an empty Self::Preedit
event will be issued.
Closed
Notifies when the IME was disabled.
After receiving this event you won’t get any more Preedit
or
Commit
events until the next Opened
event. You should
also stop issuing IME related requests like Shell::request_input_method
and clear
pending preedit text.