Skip to main content

InputEvent

Enum InputEvent 

Source
#[non_exhaustive]
pub enum InputEvent {
Show 21 variants Exit, UpdateTermArea(usize, usize), UpdateUpperMark(usize), UpdateLineNumber(LineNumbers), Number(char), RestorePrompt, HorizontalScroll(bool), UpdateLeftMark(usize), StartSelection { x: u16, y: u16, }, UpdateSelection { x: u16, y: u16, }, ClearSelection, CopySelection, Ignore, Search(SearchMode), NextMatch, PrevMatch, MoveToNextMatch(usize), MoveToPrevMatch(usize), FollowOutput(bool), ToggleSmartCase, ShowHelp,
}
Expand description

Events handled by the minus pager.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Exit

Ctrl+C or Q, exits the application.

§

UpdateTermArea(usize, usize)

The terminal was resized. Contains the new number of rows.

§

UpdateUpperMark(usize)

Sent by movement keys like Up Down, PageUp, PageDown, ‘g’, G etc. Contains the new value for the upper mark.

§

UpdateLineNumber(LineNumbers)

Ctrl+L, inverts the line number display. Contains the new value.

§

Number(char)

A number key has been pressed. This inner value is stored as a char. The input loop will append this number to its count string variable

§

RestorePrompt

Restore the original prompt

§

HorizontalScroll(bool)

Whether to allow Horizontal scrolling

§

UpdateLeftMark(usize)

Sets the left mark of Horizontal scrolling

Sent by keys like l, h, right, left etc.

§

StartSelection

Start a mouse selection at the given screen coordinates.

Fields

§

UpdateSelection

Update the current mouse selection to the given screen coordinates.

Fields

§

ClearSelection

Clear the current mouse selection.

§

CopySelection

Available on crate feature clipboard only.

Copy the current selection.

§

Ignore

Tells the event hadler to not do anything for this event

This is extremely useful when you want to execute arbitrary code on events without necessarily asking the event handler to do anything special for this event. See Custom Actions on User Events.

§

Search(SearchMode)

Available on crate feature search only.

/, Searching for certain pattern of text

§

NextMatch

👎Deprecated:

Use InputEvent::MoveToNextMatch(1) for the same effect.

Available on crate feature search only.

Get to the next match in forward mode

WARNING: This has been deprecated in favour of MoveToNextMatch. This will likely be removed in the next major release.

§

PrevMatch

👎Deprecated:

Use InputEvent::MoveToPrevMatch(1) for the same effect.

Available on crate feature search only.

Get to the previous match in forward mode

WARNING: This has been deprecated in favour of MoveToPrevMatch. This will likely be removed in the next major release.

§

MoveToNextMatch(usize)

Available on crate feature search only.

Move to the next nth match in the given direction

§

MoveToPrevMatch(usize)

Available on crate feature search only.

Move to the previous nth match in the given direction

§

FollowOutput(bool)

Control follow mode.

When set to true, minus ensures that the user’s screen always follows the end part of the output. By default it is turned off.

This is similar to Pager::follow_output except that this is used to control it from the user’s side.

§

ToggleSmartCase

Available on crate feature search only.

Toggle smart case searching mode.

§

ShowHelp

Show help message in the prompt area.

Trait Implementations§

Source§

impl Clone for InputEvent

Source§

fn clone(&self) -> InputEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for InputEvent

Source§

impl Debug for InputEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for InputEvent

Source§

impl PartialEq for InputEvent

Source§

fn eq(&self, other: &InputEvent) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InputEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.