rmux_core/
terminal_screen.rs1use rmux_proto::TerminalSize;
7
8use crate::input::OscColourSlot;
9use crate::screen::Screen;
10use crate::terminal::TerminalParser;
11use crate::terminal_passthrough::TerminalPassthrough;
12use crate::utf8::Utf8Config;
13
14pub struct TerminalScreen {
21 parser: TerminalParser,
22}
23
24impl TerminalScreen {
25 #[must_use]
28 pub fn new(size: TerminalSize, history_limit: usize) -> Self {
29 Self {
30 parser: TerminalParser::new(size, history_limit),
31 }
32 }
33
34 #[must_use]
36 pub fn screen(&self) -> &Screen {
37 self.parser.screen()
38 }
39
40 pub fn screen_mut(&mut self) -> &mut Screen {
42 self.parser.screen_mut()
43 }
44
45 #[must_use]
48 pub fn plain_output_forwarding_safe(&self) -> bool {
49 self.parser.plain_output_forwarding_safe()
50 }
51
52 pub fn set_utf8_config(&mut self, config: Utf8Config) {
54 self.parser.set_utf8_config(config);
55 }
56
57 pub fn set_alternate_screen_enabled(&mut self, enabled: bool) {
59 self.parser.set_alternate_screen_enabled(enabled);
60 }
61
62 pub fn set_title_rename_enabled(&mut self, enabled: bool) {
64 self.parser.set_title_rename_enabled(enabled);
65 }
66
67 pub fn set_input_buffer_limit(&mut self, limit: usize) {
69 self.parser.set_input_buffer_limit(limit);
70 }
71
72 pub fn resize(&mut self, size: TerminalSize) {
74 self.parser.resize(size);
75 }
76
77 pub fn feed(&mut self, bytes: &[u8]) {
79 self.parser.feed(bytes);
80 }
81
82 #[must_use]
88 pub fn take_recovery_rebase_required(&mut self) -> bool {
89 self.parser.take_recovery_rebase_required()
90 }
91
92 pub fn take_replies(&mut self) -> Vec<u8> {
94 self.parser.take_replies()
95 }
96
97 #[must_use]
99 pub fn pending_bytes(&self) -> Vec<u8> {
100 self.parser.pending_bytes()
101 }
102
103 #[must_use]
105 pub fn pending_bytes_ref(&self) -> &[u8] {
106 self.parser.pending_bytes_ref()
107 }
108
109 #[must_use]
111 pub fn clone_recovery_screen(&self) -> Screen {
112 self.parser.clone_recovery_screen()
113 }
114
115 #[must_use]
117 pub fn active_cell_state_ansi(&self) -> Vec<u8> {
118 self.parser.active_cell_state_ansi()
119 }
120
121 #[must_use]
124 pub fn active_cell_state_ansi_bounded(&self, max_hyperlink_bytes: usize) -> (Vec<u8>, bool) {
125 self.parser
126 .active_cell_state_ansi_bounded(max_hyperlink_bytes)
127 }
128
129 #[must_use]
131 pub fn saved_cell_state_ansi(&self) -> Vec<u8> {
132 self.parser.saved_cell_state_ansi()
133 }
134
135 #[must_use]
138 pub fn saved_cell_state_ansi_bounded(&self, max_hyperlink_bytes: usize) -> (Vec<u8>, bool) {
139 self.parser
140 .saved_cell_state_ansi_bounded(max_hyperlink_bytes)
141 }
142
143 #[must_use]
145 pub fn saved_cursor_state(&self) -> (u32, u32, bool) {
146 self.parser.saved_cursor_state()
147 }
148
149 #[must_use]
152 pub fn recovery_parser_state_ansi(&self) -> Vec<u8> {
153 self.parser.recovery_parser_state_ansi()
154 }
155
156 #[must_use]
158 pub fn dynamic_colour(&self, slot: OscColourSlot) -> Option<&str> {
159 self.parser.dynamic_colour(slot)
160 }
161
162 #[must_use]
164 pub fn ground_timer_active(&self) -> bool {
165 self.parser.ground_timer_active()
166 }
167
168 pub fn ground_timer_expired(&mut self) {
170 self.parser.ground_timer_expired();
171 }
172
173 pub fn take_terminal_passthrough(&mut self) -> Vec<TerminalPassthrough> {
175 self.parser.take_terminal_passthrough()
176 }
177
178 pub fn take_terminal_passthrough_dropped_count(&mut self) -> u64 {
180 self.parser.take_terminal_passthrough_dropped_count()
181 }
182
183 pub fn reset_parser(&mut self) {
186 self.parser.reset_parser();
187 }
188}