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: boolWhether the motion is linewise (j, k, gg, G) or characterwise (w, b, h, l, $).
inclusive: boolWhether 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: boolWhether 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
impl PendingMotion
Sourcepub const fn new(linewise: bool, inclusive: bool, word_forward: bool) -> Self
pub const fn new(linewise: bool, inclusive: bool, word_forward: bool) -> Self
Create a new pending motion with explicit flags.
Sourcepub const fn characterwise() -> Self
pub const fn characterwise() -> Self
Create a characterwise exclusive pending motion (w, b, h, l, etc.).
Sourcepub const fn characterwise_inclusive() -> Self
pub const fn characterwise_inclusive() -> Self
Create a characterwise inclusive pending motion ($, e, f, t, etc.).
Sourcepub const fn word_forward() -> Self
pub const fn word_forward() -> Self
Create a word-forward motion (w, W) for special cw handling.
Trait Implementations§
Source§impl Clone for PendingMotion
impl Clone for PendingMotion
Source§fn clone(&self) -> PendingMotion
fn clone(&self) -> PendingMotion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more