zellij/src/common/input/actions.rs
Jonah Caplan 44b0246e91
feat(tabs): add ability to set tab name (#212)
* send all tabs in vec

* works but no input filtering

* add event types

* add event handler for tab events

* fmt fixups

* update tab name in place, and escape rename works

* rename handle_tab_event handle_tab_rename_keypress

* handle empty new_name when renaming

* fix(tabs): pad active tab name too

* fix(tabs): report proper length

* fix(tabs): always render active tab

* style(fmt): rustfmt

Co-authored-by: Aram Drevekenin <aram@poor.dev>
2021-03-08 10:06:23 +01:00

53 lines
1.4 KiB
Rust

//! Definition of the actions that can be bound to keys.
use super::handler;
/// The four directions (left, right, up, down).
#[derive(Clone, Debug)]
pub enum Direction {
Left,
Right,
Up,
Down,
}
/// Actions that can be bound to keys.
#[derive(Clone, Debug)]
pub enum Action {
/// Quit Zellij.
Quit,
/// Write to the terminal.
Write(Vec<u8>),
/// Switch to the specified input mode.
SwitchToMode(handler::InputMode),
/// Resize focus pane in specified direction.
Resize(Direction),
/// Switch focus to next pane in specified direction.
SwitchFocus(Direction),
/// Move the focus pane in specified direction.
MoveFocus(Direction),
/// Scroll up in focus pane.
ScrollUp,
/// Scroll down in focus pane.
ScrollDown,
/// Toggle between fullscreen focus pane and normal layout.
ToggleFocusFullscreen,
/// Open a new pane in the specified direction (relative to focus).
/// If no direction is specified, will try to use the biggest available space.
NewPane(Option<Direction>),
/// Close the focus pane.
CloseFocus,
/// Create a new tab.
NewTab,
/// Do nothing.
NoOp,
/// Go to the next tab.
GoToNextTab,
/// Go to the previous tab.
GoToPreviousTab,
/// Close the current tab.
CloseTab,
GoToTab(u32),
TabNameInput(Vec<u8>),
SaveTabName,
}