#[repr(C)]pub struct CompositionCursor {
pub begin: usize,
pub end: usize,
}Expand description
Type-specific event data for text-input (editing) events.
Data carried by EventType::RawMouseMotion.
Raw motion is what a 3D viewport, a map orbit, an infinite-drag number scrubber and a first-person camera all need, and it is NOT the difference between two cursor positions. Absolute positions have already had the OS pointer-acceleration curve applied and are clamped to the screen, so differencing them gives accelerated motion that stops dead at the edge of the display. These deltas are pre-acceleration and unbounded. Where the caret sits INSIDE an open IME preedit.
Both offsets are into the preedit string, not into the document: the
preedit is not committed text and has no position in the document until it
is. An IME uses this to place its candidate window under the segment being
edited, and a begin != end pair is a SELECTED segment - several IMEs
(Japanese conversion especially) move a highlighted region through the
preedit as the user cycles candidates.
A named struct rather than the (usize, usize) this used to be, because a
non-empty tuple has no C representation - so the accessor could not be
exposed at all and no binding could read an IME’s caret.
Fields§
§begin: usizeStart offset in the preedit, in bytes.
end: usizeEnd offset. Equal to begin for a caret with no selected segment.
Trait Implementations§
Source§impl Clone for CompositionCursor
impl Clone for CompositionCursor
Source§fn clone(&self) -> CompositionCursor
fn clone(&self) -> CompositionCursor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more