winit-core: add Ime::DeleteSurroundingText API
This completes the basic API required for e.g. Wayland.
This commit is contained in:
parent
120f21a010
commit
d7fdfb1bca
4 changed files with 81 additions and 5 deletions
|
|
@ -879,6 +879,8 @@ impl From<ModifiersState> for Modifiers {
|
|||
|
||||
/// Describes [input method](https://en.wikipedia.org/wiki/Input_method) events.
|
||||
///
|
||||
/// The `Ime` events must be applied in the order they arrive.
|
||||
///
|
||||
/// This is also called a "composition event".
|
||||
///
|
||||
/// Most keypresses using a latin-like keyboard layout simply generate a
|
||||
|
|
@ -935,7 +937,7 @@ pub enum Ime {
|
|||
/// position. When it's `None`, the cursor should be hidden. When `String` is an empty string
|
||||
/// this indicates that preedit was cleared.
|
||||
///
|
||||
/// The cursor position is byte-wise indexed.
|
||||
/// The cursor position is byte-wise indexed, assuming UTF-8.
|
||||
Preedit(String, Option<(usize, usize)>),
|
||||
|
||||
/// Notifies when text should be inserted into the editor widget.
|
||||
|
|
@ -943,6 +945,20 @@ pub enum Ime {
|
|||
/// Right before this event winit will send empty [`Self::Preedit`] event.
|
||||
Commit(String),
|
||||
|
||||
/// Delete text surrounding the cursor or selection.
|
||||
///
|
||||
/// This event does not affect either the pre-edit string.
|
||||
/// This means that the application must first remove the pre-edit,
|
||||
/// then execute the deletion, then insert the removed text back.
|
||||
///
|
||||
/// This event assumes text is stored in UTF-8.
|
||||
DeleteSurrounding {
|
||||
/// Bytes to remove before the selection
|
||||
before_bytes: usize,
|
||||
/// Bytes to remove after the selection
|
||||
after_bytes: usize,
|
||||
},
|
||||
|
||||
/// Notifies when the IME was disabled.
|
||||
///
|
||||
/// After receiving this event you won't get any more [`Preedit`][Self::Preedit] or
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue