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 moresource§impl Debug for CommandContext
impl Debug for CommandContext
source§impl Default for CommandContext
impl Default for CommandContext
source§impl From<EditContext> for CommandContext
impl From<EditContext> for CommandContext
source§fn from(context: EditContext) -> Self
fn from(context: EditContext) -> Self
source§impl PartialEq for CommandContext
impl PartialEq for CommandContext
impl Eq for CommandContext
impl StructuralPartialEq for CommandContext
Auto Trait Implementations§
impl Freeze for CommandContext
impl RefUnwindSafe for CommandContext
impl Send for CommandContext
impl Sync for CommandContext
impl Unpin for CommandContext
impl UnwindSafe for CommandContext
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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)