use crate::attrs::Color;
const TERMINAL_NAME: &str = "tastty";
const DEFAULT_LIGHT_GRAY: Color = Color::Rgb(229, 229, 229);
const DEFAULT_OSC_MAX_BYTES_NORMAL: usize = 10 * 1024;
const DEFAULT_OSC_MAX_BYTES_CLIPBOARD: usize = 64 * 1024;
const DEFAULT_DCS_MAX_BYTES_DECRQSS: usize = 4 * 1024;
const DEFAULT_DCS_MAX_BYTES_XTGETTCAP: usize = 64 * 1024;
const DEFAULT_CLIPBOARD_MAX_BYTES: usize = 1024 * 1024;
const DEFAULT_TITLE_STACK_DEPTH: u16 = 10;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct HostProfile {
pub da1: Vec<u8>,
pub da2: Vec<u8>,
pub da3: Vec<u8>,
pub xtversion_name: String,
pub terminfo_name: String,
pub default_fg: Color,
pub default_bg: Color,
pub default_cursor_color: Color,
pub osc_max_bytes_normal: usize,
pub osc_max_bytes_clipboard: usize,
pub dcs_max_bytes_decrqss: usize,
pub dcs_max_bytes_xtgettcap: usize,
pub clipboard_max_bytes: usize,
pub title_stack_depth: u16,
}
impl Default for HostProfile {
fn default() -> Self {
let hex_name: String = TERMINAL_NAME.bytes().map(|b| format!("{b:02X}")).collect();
Self {
da1: b"\x1b[?62;22;52c".to_vec(),
da2: b"\x1b[>0;0;0c".to_vec(),
da3: format!("\x1bP!|{hex_name}\x1b\\").into_bytes(),
xtversion_name: format!("{TERMINAL_NAME}({})", env!("CARGO_PKG_VERSION")),
terminfo_name: TERMINAL_NAME.to_string(),
default_fg: DEFAULT_LIGHT_GRAY,
default_bg: Color::Rgb(0, 0, 0),
default_cursor_color: DEFAULT_LIGHT_GRAY,
osc_max_bytes_normal: DEFAULT_OSC_MAX_BYTES_NORMAL,
osc_max_bytes_clipboard: DEFAULT_OSC_MAX_BYTES_CLIPBOARD,
dcs_max_bytes_decrqss: DEFAULT_DCS_MAX_BYTES_DECRQSS,
dcs_max_bytes_xtgettcap: DEFAULT_DCS_MAX_BYTES_XTGETTCAP,
clipboard_max_bytes: DEFAULT_CLIPBOARD_MAX_BYTES,
title_stack_depth: DEFAULT_TITLE_STACK_DEPTH,
}
}
}