66import '../frb_generated.dart' ;
77import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart' ;
88
9- // These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `clone`, `clone`, `clone`, `fmt`, `fmt`, ` fmt`, `fmt`, `fmt`
9+ // These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `clone`, `fmt`, `fmt`, `fmt`
1010
1111/// Get the visible terminal cells for rendering.
1212List <CellData > getVisibleCells ({
@@ -24,88 +24,24 @@ CursorState getCursor({required String connId, required String terminalId}) =>
2424 terminalId: terminalId,
2525 );
2626
27- /// Scroll the terminal display (positive = up, negative = down).
28- void scroll ({
27+ /// Scroll the terminal display by delta lines (positive = up into history , negative = down).
28+ void scrollTerminal ({
2929 required String connId,
3030 required String terminalId,
3131 required int delta,
32- }) => RustLib .instance.api.crateApiTerminalScroll (
32+ }) => RustLib .instance.api.crateApiTerminalScrollTerminal (
3333 connId: connId,
3434 terminalId: terminalId,
3535 delta: delta,
3636);
3737
38- /// Get scroll info: total lines, visible lines, display offset.
39- ScrollInfo getScrollInfo ({
40- required String connId,
41- required String terminalId,
42- }) => RustLib .instance.api.crateApiTerminalGetScrollInfo (
43- connId: connId,
44- terminalId: terminalId,
45- );
46-
47- /// Start a character-level selection at col/row.
48- void startSelection ({
49- required String connId,
50- required String terminalId,
51- required int col,
52- required int row,
53- }) => RustLib .instance.api.crateApiTerminalStartSelection (
54- connId: connId,
55- terminalId: terminalId,
56- col: col,
57- row: row,
58- );
59-
60- /// Start a word (semantic) selection at col/row.
61- void startWordSelection ({
62- required String connId,
63- required String terminalId,
64- required int col,
65- required int row,
66- }) => RustLib .instance.api.crateApiTerminalStartWordSelection (
67- connId: connId,
68- terminalId: terminalId,
69- col: col,
70- row: row,
71- );
72-
73- /// Extend the current selection to col/row.
74- void updateSelection ({
75- required String connId,
76- required String terminalId,
77- required int col,
78- required int row,
79- }) => RustLib .instance.api.crateApiTerminalUpdateSelection (
80- connId: connId,
81- terminalId: terminalId,
82- col: col,
83- row: row,
84- );
85-
86- /// Clear the current selection.
87- void clearSelection ({required String connId, required String terminalId}) =>
88- RustLib .instance.api.crateApiTerminalClearSelection (
38+ /// Get the current scroll display offset (0 = at bottom).
39+ int getDisplayOffset ({required String connId, required String terminalId}) =>
40+ RustLib .instance.api.crateApiTerminalGetDisplayOffset (
8941 connId: connId,
9042 terminalId: terminalId,
9143 );
9244
93- /// Get the selected text, if any.
94- String ? getSelectedText ({required String connId, required String terminalId}) =>
95- RustLib .instance.api.crateApiTerminalGetSelectedText (
96- connId: connId,
97- terminalId: terminalId,
98- );
99-
100- /// Get selection bounds for rendering.
101- SelectionBounds ? getSelectionBounds ({
102- required String connId,
103- required String terminalId,
104- }) => RustLib .instance.api.crateApiTerminalGetSelectionBounds (
105- connId: connId,
106- terminalId: terminalId,
107- );
108-
10945/// Send text input to a terminal.
11046Future <void > sendText ({
11147 required String connId,
@@ -117,8 +53,8 @@ Future<void> sendText({
11753 text: text,
11854);
11955
120- /// Resize a terminal.
121- void resizeTerminal ({
56+ /// Resize a terminal (local + send WS message to server) .
57+ Future < void > resizeTerminal ({
12258 required String connId,
12359 required String terminalId,
12460 required int cols,
@@ -130,6 +66,20 @@ void resizeTerminal({
13066 rows: rows,
13167);
13268
69+ /// Resize only the local alacritty terminal — does NOT send a WS resize message to the server.
70+ /// Used when mobile adapts to the server's terminal size.
71+ void resizeLocal ({
72+ required String connId,
73+ required String terminalId,
74+ required int cols,
75+ required int rows,
76+ }) => RustLib .instance.api.crateApiTerminalResizeLocal (
77+ connId: connId,
78+ terminalId: terminalId,
79+ cols: cols,
80+ rows: rows,
81+ );
82+
13383/// Cell data for FFI transfer (flat, no pointers).
13484class CellData {
13585 /// The character in this cell.
@@ -197,58 +147,3 @@ class CursorState {
197147 shape == other.shape &&
198148 visible == other.visible;
199149}
200-
201- /// Scroll info for FFI transfer.
202- class ScrollInfo {
203- final int totalLines;
204- final int visibleLines;
205- final int displayOffset;
206-
207- const ScrollInfo ({
208- required this .totalLines,
209- required this .visibleLines,
210- required this .displayOffset,
211- });
212-
213- @override
214- int get hashCode =>
215- totalLines.hashCode ^ visibleLines.hashCode ^ displayOffset.hashCode;
216-
217- @override
218- bool operator == (Object other) =>
219- identical (this , other) ||
220- other is ScrollInfo &&
221- runtimeType == other.runtimeType &&
222- totalLines == other.totalLines &&
223- visibleLines == other.visibleLines &&
224- displayOffset == other.displayOffset;
225- }
226-
227- /// Selection bounds for FFI transfer.
228- class SelectionBounds {
229- final int startCol;
230- final int startRow;
231- final int endCol;
232- final int endRow;
233-
234- const SelectionBounds ({
235- required this .startCol,
236- required this .startRow,
237- required this .endCol,
238- required this .endRow,
239- });
240-
241- @override
242- int get hashCode =>
243- startCol.hashCode ^ startRow.hashCode ^ endCol.hashCode ^ endRow.hashCode;
244-
245- @override
246- bool operator == (Object other) =>
247- identical (this , other) ||
248- other is SelectionBounds &&
249- runtimeType == other.runtimeType &&
250- startCol == other.startCol &&
251- startRow == other.startRow &&
252- endCol == other.endCol &&
253- endRow == other.endRow;
254- }
0 commit comments