pub struct CommandContext {
pub context: EditContext,
/* private fields */
}
Expand description
Context object passed to each CommandFunc.
Fields§
§context: EditContext
Contextual information from user input.
Implementations§
Source§impl CommandContext
impl CommandContext
Sourcepub fn default_axis(&mut self, axis: Axis) -> &mut Self
pub fn default_axis(&mut self, axis: Axis) -> &mut Self
Indicate a default Axis to use when one hasn’t been specified via a prefix command (e.g.
:vertical
).
Sourcepub fn default_relation(&mut self, relation: MoveDir1D) -> &mut Self
pub fn default_relation(&mut self, relation: MoveDir1D) -> &mut Self
Indicate a default MoveDir1D value to use when one hasn’t been specified via a prefix command (e.g.
:aboveleft
).
Sourcepub fn relation(&self) -> MoveDir1D
pub fn relation(&self) -> MoveDir1D
Get the contextual MoveDir1D relation for newly opened windows.
Sourcepub fn open<I>(
&self,
target: OpenTarget<I::WindowId>,
count: Count,
) -> Action<I>where
I: ApplicationInfo,
pub fn open<I>(
&self,
target: OpenTarget<I::WindowId>,
count: Count,
) -> Action<I>where
I: ApplicationInfo,
Use the contextual information to create a new WindowAction::Open for the given target and size.
Sourcepub fn split<I>(
&self,
target: OpenTarget<I::WindowId>,
count: Count,
) -> Action<I>where
I: ApplicationInfo,
pub fn split<I>(
&self,
target: OpenTarget<I::WindowId>,
count: Count,
) -> Action<I>where
I: ApplicationInfo,
Use the contextual information to create a new WindowAction::Split for the given target and number of splits.
Sourcepub fn switch<I>(&self, target: OpenTarget<I::WindowId>) -> Action<I>where
I: ApplicationInfo,
pub fn switch<I>(&self, target: OpenTarget<I::WindowId>) -> Action<I>where
I: ApplicationInfo,
If no contextual information has been provided, create a new WindowAction::Switch for the
given target. If contextual information has been provided via commands like :tab
,
:vertical
, or :aboveleft
, then open the target in a new window instead.
This is meant to be a more user-friendly way to handle commands that switch to a new window by doing what the user like wanted when they used a prefix command.
Sourcepub fn window<I>(
&self,
target: OpenTarget<I::WindowId>,
size: Option<Count>,
) -> Action<I>where
I: ApplicationInfo,
pub fn window<I>(
&self,
target: OpenTarget<I::WindowId>,
size: Option<Count>,
) -> Action<I>where
I: ApplicationInfo,
Open a new window for the given target.
If size
is specified, the window will be opened with that width or height.
Trait Implementations§
Source§impl Clone for CommandContext
impl Clone for CommandContext
Source§fn clone(&self) -> CommandContext
fn clone(&self) -> CommandContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more