mod gateway;
mod gateway_input;
mod gateway_profile;
#[cfg(all(test, feature = "mux"))]
mod mux_close_confirm_tests;
pub(crate) mod notifications;
pub(crate) mod pane_write;
pub(crate) mod tmux_state;
#[cfg(feature = "mux")]
pub(crate) use notifications::mux::MuxLaunchOutcome;
pub(crate) fn mux_scrollbar_reserved_cols(scrollbar_width: f32, cell_width: f32) -> usize {
if scrollbar_width <= 0.0 || cell_width <= 0.0 {
return 0;
}
(scrollbar_width / cell_width).ceil() as usize
}
#[cfg(test)]
mod tests {
use super::mux_scrollbar_reserved_cols;
#[test]
fn scrollbar_strip_rounds_up_to_whole_cells() {
assert_eq!(mux_scrollbar_reserved_cols(15.0, 8.0), 2);
assert_eq!(mux_scrollbar_reserved_cols(16.0, 8.0), 2);
assert_eq!(mux_scrollbar_reserved_cols(17.0, 8.0), 3);
assert_eq!(
mux_scrollbar_reserved_cols(0.0, 8.0),
0,
"no scrollbar, no strip"
);
assert_eq!(
mux_scrollbar_reserved_cols(15.0, 0.0),
0,
"degenerate cell width"
);
}
}