#[non_exhaustive]pub enum TabAction<I: ApplicationInfo> {
Close(TabTarget, CloseFlags),
Extract(FocusChange, MoveDir1D),
Focus(FocusChange),
Move(FocusChange),
Open(OpenTarget<I::WindowId>, FocusChange),
}Expand description
Actions for manipulating application tabs.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Close(TabTarget, CloseFlags)
Close the TabTarget tabs with CloseFlags options.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, TabAction};
let fc = TabTarget::Single(FocusChange::Current);
let flags = CloseFlags::NONE;
let extract: Action = TabAction::Close(fc, flags).into();
assert_eq!(extract, action!("tab close -t (single current) -F none"));Extract(FocusChange, MoveDir1D)
Extract the currently focused window from the currently focused tab, and place it in a new tab.
If there is only one window in the current tab, then this does nothing.
The new tab will be placed on MoveDir1D side of the tab targeted by FocusChange. If FocusChange doesn’t resolve to a valid tab, then the new tab is placed after the currently focused tab.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, TabAction};
let extract: Action = TabAction::Extract(FocusChange::Current, MoveDir1D::Next).into();
assert_eq!(extract, action!("tab extract -f current -d next"));See the documentation for FocusChange for how to construct each of its variants with action.
Focus(FocusChange)
Change the current focus to the tab targeted by FocusChange.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, TabAction};
let extract: Action = TabAction::Focus(FocusChange::PreviouslyFocused).into();
assert_eq!(extract, action!("tab focus -f previously-focused"));See the documentation for FocusChange for how to construct each of its variants with action.
Move(FocusChange)
Move the currently focused tab to the position targeted by FocusChange.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, TabAction};
let extract: Action = TabAction::Move(FocusChange::PreviouslyFocused).into();
assert_eq!(extract, action!("tab move -f previously-focused"));See the documentation for FocusChange for how to construct each of its variants with action.
Open(OpenTarget<I::WindowId>, FocusChange)
Open a new tab after the tab targeted by FocusChange that displays the requested content.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, TabAction};
let extract: Action = TabAction::Open(OpenTarget::Current, FocusChange::PreviouslyFocused).into();
assert_eq!(extract, action!("tab open -t current -f previously-focused"));See the documentation for OpenTarget and FocusChange for how to construct each of their variants with action.