Skip to main content

rmux_core/screen/
history_bytes.rs

1use super::Screen;
2
3impl Screen {
4    /// Returns tmux-compatible grid allocation bytes for `#{history_bytes}`.
5    #[must_use]
6    pub fn tmux_history_bytes(&self) -> usize {
7        let counts = self.grid.tmux_history_byte_counts();
8        counts[1]
9            .saturating_add(counts[3])
10            .saturating_add(counts[5])
11    }
12
13    /// Returns tmux-compatible grid allocation counters for `#{history_all_bytes}`.
14    #[must_use]
15    pub fn tmux_history_all_bytes(&self) -> String {
16        let [lines, line_bytes, cells, cell_bytes, extended, extended_bytes] =
17            self.grid.tmux_history_byte_counts();
18        format!("{lines},{line_bytes},{cells},{cell_bytes},{extended},{extended_bytes}")
19    }
20}