rmux_core/input/writer.rs
1//! Screen-write abstraction used by the VT input parser.
2
3use super::cell::CellState;
4use super::InputEndType;
5
6/// Screen-write abstraction trait.
7///
8/// The parser calls these methods to effect terminal changes. `rmux-server`
9/// implements this trait against its pane/grid runtime.
10#[allow(unused_variables)]
11pub trait ScreenWriter {
12 // ─── Character output ──────────────────────────────────────
13 /// Add a printable character with current cell attributes.
14 fn collect_add(&mut self, ch: char, cell: &CellState);
15
16 /// Add a printable character, applying ACS charset if `acs` is true.
17 fn collect_add_with_charset(&mut self, ch: char, cell: &CellState, acs: bool) {
18 self.collect_add(ch, cell);
19 }
20
21 /// End character collection (flush). Called before non-print transitions.
22 fn collect_end(&mut self) {}
23
24 // ─── Cursor movement ───────────────────────────────────────
25 /// Move cursor up by `n` rows.
26 fn cursor_up(&mut self, n: u32) {}
27 /// Move cursor down by `n` rows.
28 fn cursor_down(&mut self, n: u32) {}
29 /// Move cursor left by `n` columns.
30 fn cursor_left(&mut self, n: u32) {}
31 /// Move cursor right by `n` columns.
32 fn cursor_right(&mut self, n: u32) {}
33 /// Move cursor to absolute position. -1 means "don't change".
34 fn cursor_move(&mut self, col: i32, row: i32, origin_mode: bool) {}
35
36 // ─── Line operations ───────────────────────────────────────
37 /// Insert `n` blank lines at cursor, scrolling down.
38 fn insert_line(&mut self, n: u32, bg: i32) {}
39 /// Delete `n` lines at cursor, scrolling up.
40 fn delete_line(&mut self, n: u32, bg: i32) {}
41 /// Scroll up by `n` lines.
42 fn scroll_up(&mut self, n: u32, bg: i32) {}
43 /// Scroll down by `n` lines.
44 fn scroll_down(&mut self, n: u32, bg: i32) {}
45 /// Line feed.
46 fn linefeed(&mut self, wrapped: bool, bg: i32) {}
47 /// Reverse index (scroll down or move up).
48 fn reverse_index(&mut self, bg: i32) {}
49 /// Carriage return.
50 fn carriage_return(&mut self) {}
51 /// Backspace.
52 fn backspace(&mut self) {}
53
54 // ─── Character operations ──────────────────────────────────
55 /// Insert `n` blank characters at cursor.
56 fn insert_character(&mut self, n: u32, bg: i32) {}
57 /// Delete `n` characters at cursor.
58 fn delete_character(&mut self, n: u32, bg: i32) {}
59 /// Erase (clear) `n` characters at cursor.
60 fn clear_character(&mut self, n: u32, bg: i32) {}
61
62 // ─── Erase operations ──────────────────────────────────────
63 /// Clear to end of screen.
64 fn clear_end_of_screen(&mut self, bg: i32) {}
65 /// Clear from start of screen.
66 fn clear_start_of_screen(&mut self, bg: i32) {}
67 /// Clear entire screen.
68 fn clear_screen(&mut self, bg: i32) {}
69 /// Clear scrollback history.
70 fn clear_history(&mut self) {}
71 /// Clear to end of line.
72 fn clear_end_of_line(&mut self, bg: i32) {}
73 /// Clear from start of line.
74 fn clear_start_of_line(&mut self, bg: i32) {}
75 /// Clear entire line.
76 fn clear_line(&mut self, bg: i32) {}
77
78 // ─── Mode operations ───────────────────────────────────────
79 /// Set mode bits.
80 fn mode_set(&mut self, mode: u32) {}
81 /// Clear mode bits.
82 fn mode_clear(&mut self, mode: u32) {}
83
84 // ─── Scroll region ─────────────────────────────────────────
85 /// Set scroll region (top and bottom margins, 0-based).
86 fn set_scroll_region(&mut self, top: u32, bottom: u32) {}
87
88 // ─── Alternate screen ──────────────────────────────────────
89 /// Switch to alternate screen. `save_cursor` = true for 1049.
90 fn alternate_on(&mut self, bg: i32, save_cursor: bool) {}
91 /// Switch back from alternate screen.
92 fn alternate_off(&mut self, bg: i32, restore_cursor: bool) {}
93
94 // ─── Attributes ────────────────────────────────────────────
95 /// Reset cell attributes to default.
96 fn reset_attributes(&mut self) {}
97
98 // ─── Tab handling ──────────────────────────────────────────
99 /// Handle a horizontal tab.
100 fn tab(&mut self) {}
101 /// Move cursor backward `n` tab stops (CBT).
102 fn cursor_backward_tab(&mut self, n: u32) {}
103 /// Set a tab stop at the current cursor column.
104 fn set_tab_stop(&mut self) {}
105 /// Clear a tab stop at the current cursor column.
106 fn clear_tab_stop(&mut self) {}
107 /// Clear all tab stops.
108 fn clear_all_tab_stops(&mut self) {}
109
110 // ─── Title/path ────────────────────────────────────────────
111 /// Set the pane/window title.
112 fn set_title(&mut self, title: &str) {}
113 /// Set the window name (from rename string).
114 fn set_window_name(&mut self, name: &str) {}
115 /// Set the current directory path (OSC 7).
116 fn set_path(&mut self, path: &str) {}
117
118 // ─── Cursor save/restore ───────────────────────────────────
119 /// Save cursor state (DECSC).
120 fn save_cursor(&mut self) {}
121 /// Restore cursor state (DECRC).
122 fn restore_cursor(&mut self) {}
123
124 // ─── Alignment test ────────────────────────────────────────
125 /// Fill screen with 'E' characters (DECALN).
126 fn alignment_test(&mut self) {}
127
128 // ─── Full reset ────────────────────────────────────────────
129 /// Full terminal reset (RIS).
130 fn full_reset(&mut self) {}
131
132 // ─── Synchronized output ───────────────────────────────────
133 /// Start synchronized output.
134 fn start_sync(&mut self) {}
135 /// Stop synchronized output and redraw.
136 fn stop_sync(&mut self) {}
137
138 // ─── Cursor style ──────────────────────────────────────────
139 /// Set cursor style (DECSCUSR). `n` is the Ps value 0-6.
140 fn set_cursor_style(&mut self, n: u32) {}
141
142 // ─── OSC handlers ──────────────────────────────────────────
143 /// Handle OSC 4 palette colour.
144 fn osc_palette(&mut self, data: &str, end: InputEndType) {}
145 /// Handle OSC 8 hyperlink.
146 fn osc_hyperlink(&mut self, data: &str) {}
147 /// Returns the active OSC 8 hyperlink inner ID.
148 fn current_hyperlink_id(&self) -> u32 {
149 0
150 }
151 /// Handle OSC 9 notification.
152 fn osc_notification(&mut self, data: &str) {}
153 /// Handle OSC 10 fg colour query/set.
154 fn osc_fg_colour(&mut self, data: &str, end: InputEndType) {}
155 /// Handle OSC 11 bg colour query/set.
156 fn osc_bg_colour(&mut self, data: &str, end: InputEndType) {}
157 /// Handle OSC 12 cursor colour query/set.
158 fn osc_cursor_colour(&mut self, data: &str, end: InputEndType) {}
159 /// Handle OSC 52 clipboard.
160 fn osc_clipboard(&mut self, data: &str, end: InputEndType) {}
161 /// Handle OSC 104 reset palette.
162 fn osc_reset_palette(&mut self, data: &str) {}
163 /// Handle OSC 110 reset fg.
164 fn osc_reset_fg(&mut self) {}
165 /// Handle OSC 111 reset bg.
166 fn osc_reset_bg(&mut self) {}
167 /// Handle OSC 112 reset cursor colour.
168 fn osc_reset_cursor(&mut self) {}
169 /// Handle OSC 133 shell integration.
170 fn osc_shell_integration(&mut self, data: &str) {}
171
172 // ─── DCS handlers ──────────────────────────────────────────
173 /// Handle DCS passthrough string.
174 fn dcs_passthrough(&mut self, data: &[u8]) {}
175
176 /// Handle an opaque SIXEL DCS passthrough string.
177 fn sixel_passthrough(&mut self, data: &[u8]) {}
178
179 // ─── APC handlers ──────────────────────────────────────────
180 /// Handle an opaque APC passthrough string.
181 fn apc_passthrough(&mut self, data: &[u8]) {}
182
183 // ─── Paste/focus/notify ────────────────────────────────────
184 /// Ring the bell (BEL).
185 fn bell(&mut self) {}
186
187 // ─── Query responses ───────────────────────────────────────
188 /// Get screen width in columns.
189 fn screen_size_x(&self) -> u32 {
190 80
191 }
192 /// Get screen height in rows.
193 fn screen_size_y(&self) -> u32 {
194 24
195 }
196 /// Get current cursor column (0-based).
197 fn cursor_x(&self) -> u32 {
198 0
199 }
200 /// Get current cursor row (0-based).
201 fn cursor_y(&self) -> u32 {
202 0
203 }
204 /// Get current screen mode flags.
205 fn current_mode(&self) -> u32 {
206 0
207 }
208
209 // ─── Title stack ───────────────────────────────────────────
210 /// Push current title onto the stack.
211 fn push_title(&mut self) {}
212 /// Pop title from the stack.
213 fn pop_title(&mut self) {}
214
215 // ─── Pane notification ─────────────────────────────────────
216 /// Signal that the pane title changed.
217 fn notify_pane_title_changed(&mut self) {}
218}