use std::fmt;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[cfg(feature = "tmux_3_2")]
pub enum PositionX {
ColumnNumber(usize),
TerminalCenter,
TerminalRight,
PaneBottom,
MousePosition,
StatusLineWindowPosition,
PositionFormat(PositionFormat),
}
#[cfg(feature = "tmux_3_2")]
impl fmt::Display for PositionX {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::ColumnNumber(n) => write!(f, "{}", n),
Self::TerminalCenter => write!(f, "C"),
Self::TerminalRight => write!(f, "R"),
Self::PaneBottom => write!(f, "P"),
Self::MousePosition => write!(f, "M"),
Self::StatusLineWindowPosition => write!(f, "W"),
Self::PositionFormat(s) => write!(f, "{}", s),
}
}
}
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[cfg(feature = "tmux_3_2")]
pub enum PositionY {
ColumnNumber(usize),
TerminalCenter,
PaneBottom,
MousePosition,
StatusLineWindowPosition,
AboveBelowStatusLine,
PositionFormat(PositionFormat),
}
#[cfg(feature = "tmux_3_2")]
impl fmt::Display for PositionY {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::ColumnNumber(n) => write!(f, "{}", n),
Self::TerminalCenter => write!(f, "C"),
Self::PaneBottom => write!(f, "P"),
Self::MousePosition => write!(f, "M"),
Self::StatusLineWindowPosition => write!(f, "W"),
Self::AboveBelowStatusLine => write!(f, "S"),
Self::PositionFormat(s) => write!(f, "{}", s),
}
}
}
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[cfg(feature = "tmux_3_2")]
pub enum PositionFormat {
PopupCentreX,
PopupCentreY,
PopupHeight,
PopupMouseBottom,
PopupMouseCentreX,
PopupMouseCentreY,
PopupMouseTop,
PopupMouseX,
PopupMouseY,
PopupPaneBottom,
PopupPaneLeft,
PopupPaneRight,
PopupPaneTop,
PopupStatusLineY,
PopupWidth,
PopupWindowStatusLineX,
PopupWindowStatusLineY,
}
#[cfg(feature = "tmux_3_2")]
impl fmt::Display for PositionFormat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let output = match self {
Self::PopupCentreX => "popup_centre_x",
Self::PopupCentreY => "popup_centre_y",
Self::PopupHeight => "popup_height",
Self::PopupMouseBottom => "popup_mouse_bottom",
Self::PopupMouseCentreX => "popup_mouse_centre_x",
Self::PopupMouseCentreY => "popup_mouse_centre_y",
Self::PopupMouseTop => "popup_mouse_top",
Self::PopupMouseX => "popup_mouse_x",
Self::PopupMouseY => "popup_mouse_y",
Self::PopupPaneBottom => "popup_pane_bottom",
Self::PopupPaneLeft => "popup_pane_left",
Self::PopupPaneRight => "popup_pane_right",
Self::PopupPaneTop => "popup_pane_top",
Self::PopupStatusLineY => "popup_status_line_y",
Self::PopupWidth => "popup_width",
Self::PopupWindowStatusLineX => "popup_window_status_line_x",
Self::PopupWindowStatusLineY => "popup_window_status_line_y",
};
write!(f, "#{{{}}}", output)
}
}