pub struct MouseModes(/* private fields */);Expand description
The set of mouse tracking modes an application has enabled and not yet
disabled — what it asked for, as distinct from the one protocol the
terminal reports in, which is Screen::mouse_mode.
A terminal reports mouse events in exactly one protocol, so the four
tracking modes collapse into one value on the input path: enabling
?1003 after ?1002 upgrades the reports, disabling either turns them
off. But an application enables them as a set — crossterm’s
EnableMouseCapture sends ?1000, ?1002 and ?1003 together — and
“did it ask for any-motion tracking, or only button-motion?” is a
question about that set. Whether hovering does anything at all hangs on
it, and a regression from ?1003 to ?1002 passes every test that
only reads the collapsed value while the last mode sent stays the same.
Read it from a snapshot via Screen::mouse_modes:
use termlens::MouseMode;
t.wait_until(|s| s.mouse_modes().contains(MouseMode::AnyMotion))?;Implementations§
Source§impl MouseModes
impl MouseModes
Sourcepub fn contains(self, mode: MouseMode) -> bool
pub fn contains(self, mode: MouseMode) -> bool
Whether the application currently has mode enabled.
MouseMode::None is not a tracking mode; asking for it answers
whether the set is empty, so contains(MouseMode::None) reads as
“the application asked for no tracking at all”.
Trait Implementations§
Source§impl Clone for MouseModes
impl Clone for MouseModes
impl Copy for MouseModes
Source§impl Debug for MouseModes
impl Debug for MouseModes
Source§impl Default for MouseModes
impl Default for MouseModes
Source§impl<'de> Deserialize<'de> for MouseModes
Available on crate feature serde only.Only the four tracking modes, whatever the file says (#582). The derive
took any byte, and a stray bit made len() count a mode iter() never
yields: 8 against 4 for 255. No termlens wrote one — the tracker sets
exactly those four bits — so masking drops nothing a writer recorded,
and unlike a refusal it still reads a file whose writer knew a fifth.
impl<'de> Deserialize<'de> for MouseModes
serde only.Only the four tracking modes, whatever the file says (#582). The derive
took any byte, and a stray bit made len() count a mode iter() never
yields: 8 against 4 for 255. No termlens wrote one — the tracker sets
exactly those four bits — so masking drops nothing a writer recorded,
and unlike a refusal it still reads a file whose writer knew a fifth.
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for MouseModes
Source§impl Hash for MouseModes
impl Hash for MouseModes
Source§impl PartialEq for MouseModes
impl PartialEq for MouseModes
Source§impl Serialize for MouseModes
Available on crate feature serde only.
impl Serialize for MouseModes
serde only.impl StructuralPartialEq for MouseModes
Auto Trait Implementations§
impl Freeze for MouseModes
impl RefUnwindSafe for MouseModes
impl Send for MouseModes
impl Sync for MouseModes
impl Unpin for MouseModes
impl UnsafeUnpin for MouseModes
impl UnwindSafe for MouseModes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.