Skip to main content

PendingMotion

Struct PendingMotion 

Source
pub struct PendingMotion {
    pub linewise: bool,
    pub inclusive: bool,
    pub word_forward: bool,
}
Expand description

Pending motion info for operator completion (Epic #415, Issue #388).

When the operator-pending resolver dispatches a motion, it stores info here. After the motion executes, on_command_complete uses this to complete the operator.

This replaces CommandResult::Motion - motion type classification is resolver policy knowledge, not command mechanism.

§Motion Semantics

  • Linewise: The motion affects entire lines (j, k, gg, G)
  • Inclusive: The cursor lands ON the last character of the range ($, e, f, t)
  • Exclusive: The cursor lands at the START of the next unit (w, b, h, l)
  • Word Forward: The motion is word-forward (w, W) - needs special handling for c

For operators, exclusive motions work directly with Range.end (which is exclusive), but inclusive motions need +1 adjustment to include the character under the cursor.

Fields§

§linewise: bool

Whether the motion is linewise (j, k, gg, G) or characterwise (w, b, h, l, $).

§inclusive: bool

Whether the motion is inclusive (cursor lands ON last char).

Inclusive motions: $, e, E, f, F, t, T, G, gg, % Exclusive motions: w, W, b, B, h, l, 0, ^

For characterwise inclusive motions, the end position must be adjusted by +1 to convert to exclusive range semantics.

§word_forward: bool

Whether this is a word-forward motion (w, W).

This is used by the change operator for the cw special case: cw behaves like ce (change to end of word, not to start of next word). See :help cw in Vim for documentation of this behavior.

Implementations§

Source§

impl PendingMotion

Source

pub const fn new(linewise: bool, inclusive: bool, word_forward: bool) -> Self

Create a new pending motion with explicit flags.

Source

pub const fn characterwise() -> Self

Create a characterwise exclusive pending motion (w, b, h, l, etc.).

Source

pub const fn characterwise_inclusive() -> Self

Create a characterwise inclusive pending motion ($, e, f, t, etc.).

Source

pub const fn linewise() -> Self

Create a linewise pending motion (j, k, gg, G, etc.).

Source

pub const fn word_forward() -> Self

Create a word-forward motion (w, W) for special cw handling.

Trait Implementations§

Source§

impl Clone for PendingMotion

Source§

fn clone(&self) -> PendingMotion

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PendingMotion

Source§

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

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

impl Copy for PendingMotion

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more